Skip to content

Known issues

Benjie Gillam edited this page Dec 3, 2017 · 2 revisions

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

Array dimensions - 1D only

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.

Omitting function argument that have defaults - use named function parameters

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!)