Type "vector" does not exist

Hello, I have an RPC function that matches two tables with vectors. It works perfectly on my local machine, but when I uploaded it to production, I get this error: type 'vector' does not exist. I use the SQL editor to test it, and from there it works great. Que puede ser?
21 Replies
garyaustin
garyaustin2mo ago
Is your vector extension installed in extensions?
No description
garyaustin
garyaustin2mo ago
Seems like search path issue if it does not work from REST API but works from SQL editor.
RubenMkda
RubenMkdaOP2mo ago
Yes, it is installed and I already have the tables and embeddings. I have tested it fine.
No description
RubenMkda
RubenMkdaOP2mo ago
The problem is that when I move my project to production, I get this, and locally it works fine but not in production:
No description
garyaustin
garyaustin2mo ago
Is your table in public schema? You run your postgres function in the SQL editor and it works but with rpc from REST API it does not?
RubenMkda
RubenMkdaOP2mo ago
Yes, I have everything in the public schema; it only happens in production, not locally. I really don't understand why.
RubenMkda
RubenMkdaOP2mo ago
No description
garyaustin
garyaustin2mo ago
You keep saying production, I understand that. Trying to figure out what could be different... like search_path or not in extensions, or the table being accessed is in a custom schema not available to the API or in the added search path. match_candidates_full is a postgres function?
RubenMkda
RubenMkdaOP2mo ago
Yeah
RubenMkda
RubenMkdaOP2mo ago
No description
garyaustin
garyaustin2mo ago
Can you show the function? And all the tables accessed there are all in the public schema? So far the similar issues online are vector not installed in extensions (which you show is correct) and the tables being in schemas that are not in the default search path.
RubenMkda
RubenMkdaOP2mo ago
sorry
garyaustin
garyaustin2mo ago
?
RubenMkda
RubenMkdaOP2mo ago
What is this search_path? maybe that's it
garyaustin
garyaustin2mo ago
If your tables are in the public schema then they are in the search path or should be.
garyaustin
garyaustin2mo ago
No description
garyaustin
garyaustin2mo ago
In API settings. You might also try running your SQL editor call as impersonating authenticated user if that is how your rpc call is made. https://github.com/supabase/supabase/issues/13337#issuecomment-2329785721
RubenMkda
RubenMkdaOP2mo ago
Let me see, thanks Gary, when I solve it I'll comment here anyway, thanks a lot and happy Friday :sunglaso:
RubenMkda
RubenMkdaOP2mo ago
Ok, I solved it, here is the error, the vector is not installed in the public schema.
No description
No description
garyaustin
garyaustin2mo ago
I think the solution is supposed to be to add extensions to the search path for the API or set search_path for the function, not put the extension in public. But I don't use it.
RubenMkda
RubenMkdaOP2mo ago
Well anyway, now with this I know what's going on, thanks a lot bro

Did you find this page helpful?