[tarantool-patches] Re: [PATCH v1 1/1] sql: support HAVING without GROUP BY clause

Kirill Shcherbatov kshcherbatov at tarantool.org
Thu Sep 20 15:43:49 MSK 2018


On 11.09.2018 00:43, n.pettik wrote:
> Still, other DBs (as usual I checked - Postgres, Oracle and DB2) process this
> query as well:
> 
>  select 1 from t1 having min(a) > 0;
> 
> In other words, not only aggregate can appear in SELECT args,
> but also constant literals. Semantically, it seems to be correct.
> Moreover, quieres like
> 
> select date() from t1 having min(a) > 0;
> 
> are valid too. What I mean is SELECT arguments must return
> single value for all rows in table (i.e. be single-group).
> 
> From the first sight, this problem is likely to be minor, but I guess
> we should implement correct behaviour as far as we are dealing
> with this issue right now.
This cases are totally useless, not so trivial to implement (need to calculate
expression in VDBE, e.g.
SELECT (SELECT s1 FROM te40 LIMIT 1) FROM te40 HAVING min(s1) > 0
is a valid construction for Postgress.
Moreover, current checks are the part of resolveSelectStep that 

Asked Peter, does it really important.

> Nit: use ‘is_’ or ‘if_’ prefix for predicate variable.
Ok.

> Leave here explanation comment pls. Without any notion it is
> quite hard to understand that this snippet helps to check
> HAVING without GROUP BY queries.
Ok.




More information about the Tarantool-patches mailing list