Tarantool development patches archive
 help / color / mirror / Atom feed
From: Kirill Shcherbatov <kshcherbatov@tarantool.org>
To: tarantool-patches@freelists.org, Nikita Pettik <korablev@tarantool.org>
Subject: [tarantool-patches] Re: [PATCH v1 1/1] sql: support HAVING without GROUP BY clause
Date: Thu, 20 Sep 2018 15:43:49 +0300	[thread overview]
Message-ID: <1bbae1dd-7fa1-92e8-9ed5-cf6b1d5cf6fd@tarantool.org> (raw)
In-Reply-To: <00C60996-AB0B-4157-AF8D-DCD9B1F63D8D@tarantool.org>

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.

  reply	other threads:[~2018-09-20 12:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-28 16:39 [tarantool-patches] " Kirill Shcherbatov
2018-08-29 11:52 ` [tarantool-patches] " n.pettik
2018-08-29 13:29   ` Kirill Shcherbatov
2018-09-03 11:24     ` n.pettik
2018-09-03 13:23     ` n.pettik
2018-09-10  7:51       ` Kirill Shcherbatov
2018-09-10 21:43         ` n.pettik
2018-09-20 12:43           ` Kirill Shcherbatov [this message]
2018-10-01 16:37             ` n.pettik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1bbae1dd-7fa1-92e8-9ed5-cf6b1d5cf6fd@tarantool.org \
    --to=kshcherbatov@tarantool.org \
    --cc=korablev@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='[tarantool-patches] Re: [PATCH v1 1/1] sql: support HAVING without GROUP BY clause' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox