Re: Wrong result with constant quals

From: Vik Fearing <vik(at)postgresfriends(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: Wrong result with constant quals
Date: 2022-11-04 08:07:54
Message-ID: 7c352569-be76-e796-dc7f-de28cfa0fe3e@postgresfriends.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 11/4/22 01:14, Tom Lane wrote:
> Vik Fearing <vik(at)postgresfriends(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Alvaro Herrera 2022-11-04 11:00:41 Re: BUG #17233: Incorrect behavior of DELETE command with bad subquery in WHERE clause
Previous Message Tom Lane 2022-11-04 00:14:28 Re: Wrong result with constant quals