Re: Proposal: QUALIFY clause - Mailing list pgsql-hackers

From Matheus Alcantara
Subject Re: Proposal: QUALIFY clause
Date
Msg-id DBL5H5N4UD3K.3GLPTCFIN82CI@gmail.com
Whole thread Raw
In response to Re: Proposal: QUALIFY clause  (Vik Fearing <vik@postgresfriends.org>)
Responses Re: Proposal: QUALIFY clause
List pgsql-hackers
On Mon Jul 21, 2025 at 7:11 PM -03, Vik Fearing wrote:
> That is my preferred grammar, thank you.  I have not looked at the C
> code by this can be obtained with a syntax transformation. To wit:
>
>
> SELECT a, b, c
> FROM tab
> QUALIFY wf() OVER () = ?
>
>
> can be rewritten as:
>
>
> SELECT a, b, c
> FROM (
>      SELECT a, b, c, wf() OVER () = ? AS qc
>      FROM tab
> ) AS q
> WHERE qc
>
>
> and then let the optimizer take over.  The standard does this kind of
> thing all over the place; I don't know what the postgres project's
> position on doing things like this are.
>

With this transformation users will see a Subquery plan node even if
it's not present on the original query, is that expected or it can be
confusing to users?

--
Matheus Alcantara




pgsql-hackers by date:

Previous
From: Xuneng Zhou
Date:
Subject: Re: Proposal: Limitations of palloc inside checkpointer
Next
From: Andrew Dunstan
Date:
Subject: Re: Retail DDL