Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Types for join involving Computed Relationships do not work #602

Open
2 tasks done
hmnd opened this issue Feb 14, 2025 · 2 comments
Open
2 tasks done

Types for join involving Computed Relationships do not work #602

hmnd opened this issue Feb 14, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@hmnd
Copy link

hmnd commented Feb 14, 2025

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

Resolving joins on Computed Relationships in types broke somewhere between v1.16.3 and v1.17.7, resulting in an error like: SelectQueryError<"could not find the relation between placement and hotel">.

To Reproduce

See src/supabase.test-d.ts in the working and broken branches of my repro repo: https://github.com/hmnd/postgrest-computed-rels-repro

Expected behavior

Computed Relationship is resolved successfully.

@hmnd hmnd added the bug Something isn't working label Feb 14, 2025
@hmnd
Copy link
Author

hmnd commented Feb 14, 2025

Possibly related to #474, but this broke in a later version of supabase-js: v2.47.7

@hmnd
Copy link
Author

hmnd commented Feb 14, 2025

I've added an additional branch to the same repo that demonstrates a separate, but related issue: https://github.com/hmnd/postgrest-computed-rels-repro/tree/test-diff-name

When a computed relationship is defined with a name that does not match the table involved (eg. function is placements(hotel), whereas table is placement), the types only work with the table's name, rather than the function's name, which is the opposite of what the postgrest api expects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant