-
-
Notifications
You must be signed in to change notification settings - Fork 104
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
add support for array arguments and return types in UDFs #454
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
as written there's nothing to exclude returning arrays of complex types but they aren't yet fully supported. Example below:
Either:
- updating to support arrays of row types
- filtering out functions returning non-scalar type arrays
would be great
We could also use an entry in the changelog and an update to documentation for this change
@olirice arrays of composite types are filtered out now. Docs and changelog have also been updated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just noticed the logic for applying enum variant remapping is in ColumnBuilder
so those re-mapping will not take effect if a function returns a scalar enum or an array of enum.
I've approved, but please either:
- filter those function types out
- refactor the logic so it applies to function returns too
everything else you've got here looks great!
Filtered out functions with enum and enum arrays as args or return values. Added a task in #410 to add support for them later. |
@imor Please verify this is not my setup and help to get rid of the error: begin;
create schema if not exists a1; grant usage on schema a1 to public;
create table a1.foo(id int primary key); grant select on table a1.foo to public;
insert into a1.foo (id) values (1);
create or replace function a1.bar(a1.foo) returns int[] stable return array[1, 2, 3]::int[];
grant execute on function a1.bar(a1.foo) to public;
set local search_path to a1;
comment on schema a1 is e'@graphql({"inflect_names": true})';
select graphql.resolve($$query {fooCollection {edges{node{ id bar }}}}$$); -- invalid return type from function
rollback; |
@imor I believe |
What kind of change does this PR introduce?
Feature
What is the current behavior?
Arrays are not supported in arguments and as return types of user defined functions.
What is the new behavior?
Arrays are supported in arguments and as return types of user defined functions.
Additional context
Default values for array type arguments are not supported.