-
-
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
Enhance support for UDFs #410
Comments
this is done, right?
(imo) this one can be skipped
For those one we can probably require a comment directive
Can skip for now. as you mentioned, similar software made that choice
Can skip for now. It's a low lift to ask users to return a value e.g.
+1 |
Being able to support array arguments would be amazing. I am currently attempting to write a custom query so that I can filter records from my If there's anything that could be done to help, please let me know! Thanks so much, these custom functions are going to be incredibly useful! |
@ahoopes16 support for array types is one of the next items we plan to tackle for pg_graphql. For now you can simulate multiple filter arguments by e.g. using a single argument with comma separated values. |
Yep, that's exactly the workaround that we came to as well. Thanks! |
@imor @ahoopes16 I don't see any supported string splitting functions available to my UDFs. How are you taking a comma delimited string and splitting that to be used for a "where" clause? Can you show me an example of a simple function that does this? |
@tylerdmace Sure thing! So for this example, let's say that we have a create or replace function search_courses(author_ids text default null)
returns setof courses
stable
language plpgsql
as
$$
declare
begin
return query select c.* from courses c
where
search_courses.author_ids is null or
c.author_id::text = any(string_to_array(search_courses.author_ids, ','));
end
$$; The piece that you're looking for specifically is the All of this being said, it looks like pg_graphql now supports array arguments in UDFs so this workaround is likely no longer necessary 😅 I hope this helps! |
This was exactly what I was looking for. I swear I had tried to use |
Strange! It's been working great for us on Postgres 15, although |
It worked perfectly! Thank you so much, my friend. |
Thanks for the work so far and I've done a small one-time sponsorship to support further work on this issue. |
Scope of the PR to add basic support for UDFs has been cut down in the interest of getting basic support out. This is an issue to keep track of those features which were cut from the scope.
The following items need to be supported to further enhance support for UDFs:
__schema
The text was updated successfully, but these errors were encountered: