S
Supabase2mo ago
kaleab

Supabase queue

I was using the queue plugin (pgmq) and looking through the supabase API reference i don't see a function read_with_poll which is a function pgmq supports. Does Supabase support it and it wasn't included in the reference or is it not implemented?
5 Replies
garyaustin
garyaustin2mo ago
Not sure, but Supabase version is 1.4.4 Seems like the call has performance issues at least on that version. https://discord.com/channels/839993398554656828/1324069440815497256
kaleab
kaleabOP2mo ago
But it work for you? The functions pgmq gives you and the functions exposed through postgRest from supabase have different parameter names and orders so I don't know how to use the function through the supabase client.
tomaspozo
tomaspozo2mo ago
I imagine you are referencing to the pgmq API that Supabase expose, and yes is a little different and does not offer all the available functions (its a wrapper to allow the usage from the Data API with the Supabase client). What I've done when I need one of the other functions, like read_with_poll, is to create a DB function that makes the direct call to the pgmq schema and later call this function from the SB client on my app. Note that these functions will need to be security definer to access the pgmq schema, so make sure you add some sort of validation in your function to check if the user can call it.
kaleab
kaleabOP2mo ago
That is exactly what i was referencing too. I tried to find the wrapper in the supabase-js client source but it wasn't there. Maybe it is located somewhere but i couldn't find it. I was thinking of building similar kind of wrapper as the one provided by supabase for consistency and security too.
garyaustin
garyaustin2mo ago
There is not one. The suggestion was to use an rpc call to a postgres function. There are no wrappers for any of pgmq calls in supabase-js. You use rpc to the set of database functions they added as "wrappers". BUT my point was Supabase may be leaving this one out because the version they offer has a performance issue with that polling function. The link talks about needing a more recent version or "patching" with SQL.

Did you find this page helpful?