More aggregate functions such as `array_agg` and `json_agg`
See original GitHub issueIt seems like this library currently only supports a subset of aggregate functions like count
, max
and min
. Would it be possible to support array_agg
or json_agg
?
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Documentation: 9.5: Aggregate Functions - PostgreSQL
The aggregate functions array_agg , json_agg , jsonb_agg , json_object_agg ... out merely to avoid cluttering the listing of more-commonly-used aggregates.
Read more >array_agg(), string_agg(), jsonb_agg(), jsonb_object_agg()
This aggregate function, together with json_agg() , are described fully in the jsonb_agg() section within the overall JSON section. ... Purpose: Returns a...
Read more >Aggregate functions | BigQuery - Google Cloud
To learn about the syntax for aggregate function calls, see Aggregate ... SELECT ARRAY_AGG(x) AS array_agg FROM UNNEST([2, 1,-2, 3, -2, 1, 2])...
Read more >Have multiple aggregations in a query always the same order?
Given an sql query with multiple aggregates, especially array_agg , is the order of the aggregated values deterministic? Example: SELECT ...
Read more >9.21. Aggregate Functions - Crunchy Data
Collects all the input values, including nulls, into an array. No. array_agg ( anyarray ) → anyarray. Concatenates all the input arrays into...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks for the help. My use case is mostly within subqueries. After fiddling around, I came up with the following generic wrapper, which seems to produce both correct SQL and Typescript types:
I don’t know. Maybe. That’s the thing. It’s really difficult to write helpers that work in all cases, but pretty easy to write helpers that work for your own use case. For example, you could write this type-safe helper:
where
Database
is fromKysely<Database>
.