Re: Wrong result with constant quals - Mailing list pgsql-bugs

From Vik Fearing
Subject Re: Wrong result with constant quals
Date
Msg-id 7c352569-be76-e796-dc7f-de28cfa0fe3e@postgresfriends.org
Whole thread Raw
In response to Re: Wrong result with constant quals  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On 11/4/22 01:14, Tom Lane wrote:
> Vik Fearing <vik@postgresfriends.org> 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




pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Wrong result with constant quals
Next
From: Alvaro Herrera
Date:
Subject: Re: BUG #17233: Incorrect behavior of DELETE command with bad subquery in WHERE clause