-
-
Notifications
You must be signed in to change notification settings - Fork 167
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Bug report
- I confirm this is a bug with Supabase, not with my own application.
- I confirm I have searched the Docs, GitHub Discussions, and Discord.
Describe the bug
When sorting grouped functions for schema generation, postgres-meta does not sort function definitions by SetofOptions, which leads to unstable schema generation.
To Reproduce
- Create multiple join functions that take different table type as arguments but return the same set of table row. In other words, define join functions for B -> A, C -> A, D -> A
- Run typegen
- dump database
- supabase db reset
- restore database
- typegen <- doesn't always change but also doesn't always stay the same
Expected behavior
schema generation should be deterministic and stable, regardless of function return type
Screenshots
System information
- OS: macOS or Linux
Browser (if applies) [e.g. chrome, safari]Version of supabase-js: [e.g. 6.0.2]- Version of Node.js: 22.14.0
- "supabase": "^2.54.11"
Additional context
The problem is this sort right here: https://github.com/supabase/postgres-meta/blob/master/src/server/templates/typescript.ts#L685
This line gives different loop results because sourceTable isn't part of the sort behavior above: https://github.com/supabase/postgres-meta/blob/master/src/server/templates/typescript.ts#L256
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working