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
When joining a related one-to-one table using the ... spread operator, the type generation assumes that the rows exist in the related table and does not have null as an option for the child table column values, however the returned data has null values for rows where the row is missing.
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
Create a table parent with an id column as the primary key.
Create a table (child) with a foreign key relationship to parent (id) (we'll call this column parent_id), and a constraint unique (parent_id). For the example we will add two columns col_1, col_2 which have type boolean and are not null.
Run a query with supabase-js with the spread operator const { data, error } = db.from("parent").select("id,...child(col_1,col_2).
Expected behavior
Since the child row might not exist for a given parent row, the type of data should be:
We've reworked the result inference in postgrest-js to address the typing issues mentioned above. The changes are available in a canary release, and we're actively seeking your feedback.
To test it out, update your supabase-js to version 2.46.0-rc.1 (which includes postgrest-js1.17.0-rc.1):
We've reworked the result inference in postgrest-js to address the typing issues mentioned above. The changes are available in a canary release, and we're actively seeking your feedback.
To test it out, update your supabase-js to version 2.46.0-rc.1 (which includes postgrest-js1.17.0-rc.1):
Bug report
Describe the bug
When joining a related one-to-one table using the
...
spread operator, the type generation assumes that the rows exist in the related table and does not havenull
as an option for the child table column values, however the returned data hasnull
values for rows where the row is missing.To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
parent
with anid
column as the primary key.parent (id)
(we'll call this columnparent_id
), and a constraintunique (parent_id)
. For the example we will add two columnscol_1
,col_2
which have typeboolean
and arenot null
.supabase-js
with the spread operatorconst { data, error } = db.from("parent").select("id,...child(col_1,col_2)
.Expected behavior
Since the
child
row might not exist for a givenparent
row, the type ofdata
should be:instead it gives:
The returned data contains
null
values as expected which makes the typing inaccurate.System information
The text was updated successfully, but these errors were encountered: