ANY_VALUE aggregate
Vik Fearing <vik@postgresfriends.org>
From: Vik Fearing <vik@postgresfriends.org>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2022-12-05T14:57:13Z
Lists: pgsql-hackers
Attachments
- 0001-Implement-ANY_VALUE-aggregate.patch (text/x-patch) patch 0001
The SQL:2023 Standard defines a new aggregate named ANY_VALUE. It returns an implementation-dependent (i.e. non-deterministic) value from the rows in its group. PFA an implementation of this aggregate. Ideally, the transition function would stop being called after the first non-null was found, and then the entire aggregation would stop when all functions say they are finished[*], but this patch does not go anywhere near that far. This patch is based off of commit fb958b5da8. [*] I can imagine something like array_agg(c ORDER BY x LIMIT 5) to get the top five of something without going through a LATERAL subquery. -- Vik Fearing
Commits
-
Implement ANY_VALUE aggregate
- 2ddab010c277 16.0 landed
-
Generalize ri_RootToPartitionMap to use for non-partition children
- fb958b5da86d 16.0 cited