From: Matheus Alcantara <matheusssilv97@gmail.com>
To: Vik Fearing <vik@postgresfriends.org>
To: Pg Hackers <pgsql-hackers@postgresql.org>
Cc: Peter Eisentraut <peter@eisentraut.org>
Subject: Re: Proposal: QUALIFY clause
Date: Fri, 25 Jul 2025 09:55:01 -0300
Message-ID: <DBL5H5N4UD3K.3GLPTCFIN82CI@gmail.com> (raw)
In-Reply-To: <6c998e4f-f6f2-43c2-8b67-cfff360ef241@postgresfriends.org>
References: <CAFY6G8euMWRjTEdRV9M=RL2_EJNDm5UNeHat9U1FGGwzfjGSfw@mail.gmail.com>
<a042f530-90a4-46fc-8595-43053fcfc06e@postgresfriends.org>
<DBI1WKCGAPN4.321XNB6R2YKPT@gmail.com>
<6c998e4f-f6f2-43c2-8b67-cfff360ef241@postgresfriends.org>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: matheusssilv97@gmail.com, vik@postgresfriends.org, peter@eisentraut.org
Subject: Re: Proposal: QUALIFY clause
In-Reply-To: <DBL5H5N4UD3K.3GLPTCFIN82CI@gmail.com>
References: <CAFY6G8euMWRjTEdRV9M=RL2_EJNDm5UNeHat9U1FGGwzfjGSfw@mail.gmail.com> <a042f530-90a4-46fc-8595-43053fcfc06e@postgresfriends.org> <DBI1WKCGAPN4.321XNB6R2YKPT@gmail.com> <6c998e4f-f6f2-43c2-8b67-cfff360ef241@postgresfriends.org> <DBL5H5N4UD3K.3GLPTCFIN82CI@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox