-
-
Notifications
You must be signed in to change notification settings - Fork 151
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Bug report
- [ x] I confirm this is a bug with Supabase, not with my own application.
- [ x] I confirm I have searched the Docs, GitHub Discussions, and Discord.
Describe the bug
Type generation error with Computed Relationships.
Returns setof table is generated as object type instead of array of objects
To Reproduce
CREATE TABLE IF NOT EXISTS "public"."nodes" (
"id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL,
"parent" "uuid",
);
ALTER TABLE ONLY "public"."nodes"
ADD CONSTRAINT "nodes_parent_fkey" FOREIGN KEY ("parent") REFERENCES "public"."nodes"("id") ON UPDATE CASCADE ON DELETE CASCADE;
create or replace function "public"."nodes_children"(nodes) returns setof nodes as $$
select * from nodes where parent = $1.id
$$ stable language sql;
create or replace function "public"."nodes_child"(nodes) returns nodes as $$
select * from nodes where parent = $1.id limit 1
$$ stable language sql;
supabase gen types typescript --local > src/db/supabase-types.ts
Expected behavior
nodes: {
Row: {
id: string
parent: string | null
nodes_child: Database["public"]["Tables"]["nodes"]["Row"] | null
nodes_children: Database["public"]["Tables"]["nodes"]["Row"] | null // expected this to be an array
}
expected nodes_children to be an array
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working