NolanOK cool, so
return execute select...? Thanks, that's perfect. All the examples I saw when searching for this used some sort of looping construct and
next, seemed to have custom types, or just created a function and showed using its output with setof. Great at illustrating a point, but not so good at helping me just return query results and be done with it. :)
NolanAnd if I have a setof query, I can add limits/pagination client-side even if the query in the function just does
select * from mytable;?
NolanAs an aside, I'm really getting into this. Just created 4 test users to start testing RLS and custom queries. I could just do it from the psql console instead of going through my app's account creation procedure, or creating bunches of associated records via raw
NolanInteresting, I created a custom query but didn't add any grant execute statements, and it seems to run without errors. Is it just running and returning null?
NolanBy 'run without errors' I mean the client returns 0 errors according to the logs. Haven't looked at the network request yet.
NolanHappy to see RLS making my query logic cleaner, not having to tack on a bunch of
whereclauses based on roles in each and every query.
NolanHaving some trouble porting my first update mutation to postgraphile. https://pastebin.com/hu7virAn That's with
postgraphile:graphql,postgraphile:postgres,postgraphile:postgres:error. Looks like there's no query, and the result of
NolanMy id field is a
uuid, wondering if the parameter in the mutation is off since it's
ID!but nothing else in the stack reports a type mismatch. Happy to provide additional debugging details.
"set-returning functions must appear at top level of FROM",would happen?
this is a more complete error
postgraphile:postgres begin +22s postgraphile:postgres select set_config($1, $2, true), set_config($3, $4, true) +2ms postgraphile:postgres with __local_0__ as ( postgraphile:postgres select to_json(__local_1__.__local_1__) as "value" postgraphile:postgres from unnest("crtrs"."get_notifications_alt"()) as __local_1__ postgraphile:postgres postgraphile:postgres where (TRUE) and (TRUE) postgraphile:postgres postgraphile:postgres postgraphile:postgres postgraphile:postgres ), __local_2__ as (select json_agg(to_json(__local_0__)) as data from __local_0__) select coalesce((select __local_2__.data from __local_2__), ''::json) as "data" +2ms postgraphile:postgres:error error: set-returning functions must appear at top level of FROM
select * from crtrs.get_notifications_alt();on my ide, it works ok