Open StevenClontz opened 7 months ago
I've noticed this as well.
From what I understand, on a self-referential relationship on a relation collection
, when encountering a query like *, collection(*)
, PostgREST actually prioritizes the foreign relationship (i.e. from-many reference), since the local reference (i.e. to-one reference) can be specified with the column name e.g. *, parent_id(*)
.
The source for this is at select-query-parser.ts
.
Bug report
Describe the bug
I believe there's a typing issue when querying children of a row. I'm relatively new so this could possibly be user error, but I received no feedback via Discord nor StackOverflow.
To Reproduce
I have the following generated (from supabase-cli) type for my
collections
table:I'm grabbing a particular collection like so:
And this is the typing that's been inferred:
Expected behavior
In particular,
collections
is typed as an object, not an array of objects. However, if I coerce the typing to beany
,collections
is an array as expected, so this is just an issue with the generated type. Any clues on what I've done wrong or how to fix things?System information