You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
but the no nulls constraint doesn't show up in pgFieldIntrospection or pgIntrospection is there a way to automatically detect it?
If yes i think it would be possible to always add the inner non null since if row level constraints are present the whole row is null.
Then there is the sql codegen. Currently selecting an array generates this query
case when (__local_1__."array") is null then null when coalesce(
array_length(
(__local_1__."array"),
1
),
0
) =0 then '[]'::json else (
select json_agg(__local_2__)
from unnest((__local_1__."array")) as __local_2__
) end
which is i guess the paranoid version to guarantee an empty array even when row level security denied access. Is it possible to tell postgraphile to assume it's always allowed and thus shorten the query to
to_json(__local_1__."array")
inside a json_build_object even the to_json could be omitted
Additional context
postgraphile: 4.12.11
PostgreSQL: 14.5
The text was updated successfully, but these errors were encountered:
Alternatively you can use makeChangeNullabilityPlugin in V5, which allows you to specify the nullability of any field or argument including the nullability of of list items.
Using a domain gives you a way to automatically detect it, you then need to hook it with a plugin. I think the domain trick probably already works without an extra plugin in v5 🤷♂️
Summary
https://www.graphile.org/postgraphile/why-nullable/ doesn't mention arrays which can't contain nulls.
I tried:
but that doesn't change anything.
With this plugin i was able to change the GraphQL type
but the no nulls constraint doesn't show up in
pgFieldIntrospection
orpgIntrospection
is there a way to automatically detect it?If yes i think it would be possible to always add the inner non null since if row level constraints are present the whole row is null.
Then there is the sql codegen. Currently selecting an array generates this query
which is i guess the paranoid version to guarantee an empty array even when row level security denied access. Is it possible to tell postgraphile to assume it's always allowed and thus shorten the query to
to_json(__local_1__."array")
inside a
json_build_object
even theto_json
could be omittedAdditional context
postgraphile: 4.12.11
PostgreSQL: 14.5
The text was updated successfully, but these errors were encountered: