From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 72535289D9 for ; Thu, 20 Sep 2018 08:43:52 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yfRREC1VhGsA for ; Thu, 20 Sep 2018 08:43:52 -0400 (EDT) Received: from smtpng2.m.smailru.net (smtpng2.m.smailru.net [94.100.179.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id CDB4527B8E for ; Thu, 20 Sep 2018 08:43:51 -0400 (EDT) Subject: [tarantool-patches] Re: [PATCH v1 1/1] sql: support HAVING without GROUP BY clause References: <16D5B1D2-2DBF-4BAE-9C5D-F23CCCE3723D@tarantool.org> <5f602cc5-9617-6717-c13a-4d5595c23422@tarantool.org> <99A1FBB4-3831-4BB6-A1D6-505D09F792AD@tarantool.org> <077750b5-7433-6122-5df9-caa6ff462e70@tarantool.org> <00C60996-AB0B-4157-AF8D-DCD9B1F63D8D@tarantool.org> From: Kirill Shcherbatov Message-ID: <1bbae1dd-7fa1-92e8-9ed5-cf6b1d5cf6fd@tarantool.org> Date: Thu, 20 Sep 2018 15:43:49 +0300 MIME-Version: 1.0 In-Reply-To: <00C60996-AB0B-4157-AF8D-DCD9B1F63D8D@tarantool.org> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: tarantool-patches@freelists.org, Nikita Pettik 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.