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

Supabase type error when querying computed field of rpc result #1366

Open
2 tasks done
gwax opened this issue Jan 28, 2025 · 0 comments
Open
2 tasks done

Supabase type error when querying computed field of rpc result #1366

gwax opened this issue Jan 28, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@gwax
Copy link

gwax commented Jan 28, 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

Supabase supports selecting computed fields from RPC results via postgrest but the type system shows an error when attempting to do so.

Errors show up as SelectQueryError<"column ... does not exist on ..."> but the query still works as expected.

To Reproduce

Minimal reproduction is available in the gwax/rpc-compted-fields branch here: https://github.com/manapoolinc/supabase-playground/tree/gwax/rpc-computed-fields

  1. Make a table returning rpc: https://github.com/manapoolinc/supabase-playground/blob/gwax/rpc-computed-fields/supabase/migrations/20250127194033_create_country_fns.sql#L1
  2. Make a computed field on the returned table type: https://github.com/manapoolinc/supabase-playground/blob/gwax/rpc-computed-fields/supabase/migrations/20250127194033_create_country_fns.sql#L11
  3. Query the rpc with a select containing the computed field: https://github.com/manapoolinc/supabase-playground/blob/gwax/rpc-computed-fields/src/lib/db/countries.ts#L37
  4. See type error in IDE and typescript compiler: https://github.com/manapoolinc/supabase-playground/blob/gwax/rpc-computed-fields/src/lib/db/countries.ts#L61

Expected behavior

No Type Errors in reproduction code

System information

  • Version of supabase: 2.6.8
  • Version of supabase-js: 2.48.1
@gwax gwax added the bug Something isn't working label Jan 28, 2025
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