supabase / postgrest-js

Isomorphic JavaScript client for PostgREST.

Home Page:https://supabase.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incorrect RPC Types After Select

jdgamble555 opened this issue · comments

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

The Typing For RPC Functions is incorrect after a select. I do not have access to eq, contains, or, etc...

For example:

const { data, error } = await supabase.rpc('custom_function').select('*, author(*)')
.eq(... // can't do this
.or(... // can't do this

To Reproduce

  1. Create an rpc function that returns a setof posts (or any table).
  2. Make sure to update your types supabase gen types typescript --local > database.ts (or whatever file)
  3. Import the types in your createClient as usual per the generating types

This is the result:

rpc function

Expected behavior

from and rpc should work the exact same way:

from function

You can see I can scroll a lot further in this example.

System information

  • OS: Windows 11
  • Version of supabase-js: 2.36.0
  • Version of supabase: 1.99.5
  • Version of Node.js: 18

Additional context

It is very important to note that this DOES WORK. postgREST DOES support these filters. supabase-js does not.

J

This can actually be closed out. You can do the eq and all the other filters before the select, which is probably more efficient anyways. Didn't think of that before.

J