-
-
Notifications
You must be signed in to change notification settings - Fork 577
Known issues
This page documents known issues with PostGraphQL that we have not found a way to solve in core. If you know of a way to solve these things, please get in touch with @benjie
From the PostgreSQL docs (8.15.1):
The current implementation does not enforce the declared number of dimensions either. Arrays of a particular element type are all considered to be of the same type, regardless of size or number of dimensions.
PostGraphQL treats all arrays as one-dimensional. There's currently no work-around for detecting and exposing two or higher dimensional arrays.
A function such as this:
create function test(a int, b int default 0, c int default 0) returns int as $$
select a + b + c;
$$ language sql stable strict;
Can be called like this:
select test(1, c := 3);
(i.e. omitting the parameter b
, which results in its default being used).
However if you do not use named arguments there's no equivalent for positional calling of the function:
create function test2(int, int default 0, int default 0) returns int as $$
select $1 + $2 + $3;
$$ language sql stable strict;
select test2(1, ???, 3);
From pg_proc you can get the proargdefaults
but they are in "Expression trees (in nodeToString() representation)" - a format we don't know how to turn back into a value.
We therefore replace any omitted arguments with null
:
select test2(1, null, 3);
For many functions (and all strict
functions) this will result in a null
result.
The workaround is to name your function parameters (or at least the ones with defaults!)