Re: How can I create a feature request for QUALIFY clause into PostgreSQL? - Mailing list pgsql-novice

From Laurenz Albe
Subject Re: How can I create a feature request for QUALIFY clause into PostgreSQL?
Date
Msg-id f17dd31391b98c32b98ffcadb7aed164229695ba.camel@cybertec.at
Whole thread Raw
In response to How can I create a feature request for QUALIFY clause into PostgreSQL?  (Onni Hakala <onni@keksi.io>)
Responses Re: How can I create a feature request for QUALIFY clause into PostgreSQL?  (Onni Hakala <onni@keksi.io>)
List pgsql-novice
On Mon, 2022-10-03 at 20:38 +0300, Onni Hakala wrote:
> I was very happy learn about QUALIFY clause in BigQuery today.
> 
> I have used window functions usually with subqueries like this:
> SELECT * FROM (
>   SELECT
>     *,
>     ROW_NUMBER OVER (PARTITION BY something ORDER BY modified_date DESC) AS row_number
>   FROM table_name
> )
> WHERE row_number = 1
> 
> 
> With QUALIFY it's much more ergonomic and cleaner to do the same thing.
> SELECT *
> FROM table_name
> QUALIFY ROW_NUMBER() OVER (PARTITION BY something ORDER BY modified_date DESC) = 1
> 
> 
> QUALIFY is also better since it doesn't include extra column row_number to the result.
> 
> Where should I send message so that Postgres maintainers would consider adding this into the TODO
page: https://wiki.postgresql.org/wiki/Todo

PostgreSQL supports DISTICT ON, which can do this even more ergonomically.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com



pgsql-novice by date:

Previous
From: Onni Hakala
Date:
Subject: How can I create a feature request for QUALIFY clause into PostgreSQL?
Next
From: Onni Hakala
Date:
Subject: Re: How can I create a feature request for QUALIFY clause into PostgreSQL?