Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oqrk8-0006OZ-Tq for pgsql-bugs@arkaria.postgresql.org; Fri, 04 Nov 2022 08:08:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oqrk7-0005HZ-RQ for pgsql-bugs@arkaria.postgresql.org; Fri, 04 Nov 2022 08:07:59 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oqrk7-0005HQ-J6 for pgsql-bugs@lists.postgresql.org; Fri, 04 Nov 2022 08:07:59 +0000 Received: from relay11.mail.gandi.net ([2001:4b98:dc4:8::231]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oqrk5-0007YM-JX for pgsql-bugs@postgresql.org; Fri, 04 Nov 2022 08:07:59 +0000 Received: (Authenticated sender: vik@postgresfriends.org) by mail.gandi.net (Postfix) with ESMTPSA id A25E210000B; Fri, 4 Nov 2022 08:07:55 +0000 (UTC) Message-ID: <7c352569-be76-e796-dc7f-de28cfa0fe3e@postgresfriends.org> Date: Fri, 4 Nov 2022 09:07:54 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: Wrong result with constant quals Content-Language: en-US To: Tom Lane Cc: pgsql-bugs References: <2193245.1667518580@sss.pgh.pa.us> <309137b4-9b48-5952-c6e1-0fa7007d0419@postgresfriends.org> <2198598.1667520868@sss.pgh.pa.us> From: Vik Fearing In-Reply-To: <2198598.1667520868@sss.pgh.pa.us> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 11/4/22 01:14, Tom Lane wrote: > Vik Fearing writes: >> I allowed for this by saying it could be a single group with no rows if >> you preferred to look at it that way. > > That is exactly what the standard says. > >> This does not explain why the WHERE FALSE is being ignored and producing >> rows. > > It's not ignored, but it applies to the pre-grouping rows, of which > there aren't any to remove. But there's still a group. Okay, I can see better what is happening with this query: select 42 from (values (1), (2), (3)) as _ having true; ?column? ---------- 42 (1 row) -- Vik Fearing