-
-
Notifications
You must be signed in to change notification settings - Fork 254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Returning tuples from Aggs not supported #477
Comments
Thanks @jamessewell ! Let me know if I can help at all. |
I don't know if this is gonna work. I eventually got it to compile once I realised I need to break out the #type_finalize type from
Then I can use Then it compiles, but we get:
Normal functions seem to get round this by wrapping like so:
But ...
I need a bag of magic :( |
Yeah, |
Hmmm I tried this on 2817f84 However when I try to load an example: ana@autonoma:~/git/zombodb/pgx/pgx-tests$ cargo pgx run pg14 --features pg_test
Stopping Postgres v14
building extension with features `pg_test pg14`
"cargo" "build" "--features" "pg_test pg14" "--no-default-features" "--message-format=json-render-diagnostics"
Finished dev [unoptimized + debuginfo] target(s) in 0.08s
installing extension
Copying control file to /home/ana/.pgx/14.2/pgx-install/share/postgresql/extension/pgx_tests.control
Copying shared library to /home/ana/.pgx/14.2/pgx-install/lib/postgresql/pgx_tests.so
Discovering SQL entities
Discovered 335 SQL entities: 32 schemas (2 unique), 284 functions, 12 types, 1 enums, 2 sqls, 0 ords, 0 hashes, 4 aggregates
Writing SQL entities to /home/ana/.pgx/14.2/pgx-install/share/postgresql/extension/pgx_tests--1.0.sql
Finished installing pgx_tests
Starting Postgres v14 on port 28814
Re-using existing database pgx_tests
psql (14.2)
Type "help" for help.
pgx_tests=# create extension pgx_tests;
ERROR: function demo_count_and_sum_finalize(democountandsum) returns a set |
I ran across this today. I would like for the finalfunc to be a set returning function like: type Finalize = TableIterator<
'_,
(
name!(time, Option<TimestampWithTimeZone>),
name!(peak, Option<f64>),
),
>; Any ideas on what needs to be done in order to make this work? My work around for now is to aggregate to JSONB then call another UDF that parses the JSONB back into a TableIterator. That can get rather expensive. |
It would be great to be able to return a tuple like
(i32, i32)
from an Aggregate like you can with normal functions.I'm having a go at doing this myself, but just wanted to make an issue to track.
The text was updated successfully, but these errors were encountered: