When building simple select queries in GraphQL (really simple ones), the query is being transformed to a function, sending the values through as parameters.
We ran into instances where the select for 50 columns in the schema (a standard employment record, nothing special) is transformed and we end up getting the
cannot pass more than 100 arguments to a function as included below.
I am genuinely curious if anyone else ran into this limitation, as I searched far and wide, and could not find anything except on Postgres forums and the solution they have as detailed below under
root cause, which is not applicable unless built into
Data Connect.Replication:You can create a table with 51 columns in the
schema.gql. Select these columns from
queries.gql and you will get the below error.
The error as reference:u/firebase/data-connect: DataConnect (11.4.0): Error while performing request: {"error":{"code":400,"message":"cannot prepare SQL statement: *SELECT ... END* SQL Error: pq: cannot pass more than 100 arguments to a function","status":"FAILED\_PRECONDITION"}}Root cause:This is a
Postgres issue, but can be avoided, as in
Postgres you can use arrays as parameters:
( reference:
https://stackoverflow.com/questions/17421265/postgresql-how-to-pass-more-than-100-arguments-to-a-function ). It would allow users to scale, and makes this a more robust solution.
I could honestly find no one that ran into this issue, and it seems this is purely because of how
Data Connect converts it to a function. I could find no settings, nor workaround. So this means we are at a point where we need to abandon
Data Connect or pray that we are missing something crucial. I will reach out to the team, and give feedback here. Just in case someone runs into the same blocker.