News for hackers. Stuff that matters.
Re:Ask HN: Does anyone else think SQL needs help? by hantusk on Sunday September 11, 2022 @12:23PM (#32800948)
Postgres can do the"function over (partition by col_a order by col_b) as well.

Agree, SQL can already do what the OP proposes in almost the exact same syntax.

and together with CTEs, intermediate temp tables or views, you can totally avoid the spaghetti and break down the queries in manageable chunks.

Re:Ask HN: Does anyone else think SQL needs help? by tacosbane on Sunday September 11, 2022 @02:26PM (#32802007)
postgres has window functions but it does not have the `qualify` clause.
Re:Ask HN: Does anyone else think SQL needs help? by ttfkam on Monday September 12, 2022 @11:51AM (#32812133)
True, but you can simulate it by running the query with the window function in a CTE and then make a separate SELECT with the appropriate WHERE clause. More verbose, but the same effect and result. Using NOT MATERIALIZED on the CTE can also potentially let the planner do better query optimization on it.