How to move pg_net extension to from public to extensions schema ?

I need to move ph_net extension from public the extensions schema but everything I tried fails. It seems that I don't have the right permissions to do so although I am the owner and admin of this Supabase project. I tried generating code with the Supabse AI, Claude and ChatGPT but nothing worked. I reached out to the support team but haven't heard back 🙁 Can anyone (perhaps the Supabase support team is lurking here somewhere) help out?
13 Replies
garyaustin
garyaustin2d ago
Uninstall and reinstall from the UI?
lavik17
lavik17OP2d ago
I'm actually a bit afraid I'll have permission issues that will prevent me from reinstalling it, or updating the cron jobs after the move
garyaustin
garyaustin2d ago
No other way to do it that I know of. Are the cron jobs not running net.pg_net?
lavik17
lavik17OP2d ago
they all run net.pg_net
garyaustin
garyaustin2d ago
Not sure how they would be impacted then. That is the typical way to reset an extension.
But if you changed grants in your messing around with it then your risk would be higher.
lavik17
lavik17OP2d ago
I didn't make any change yet, that's why I was asking for Supabase support team for guidance... According to Claude I should be able to delete and re-create the net_pg in extensions. Then the cron jobs should be modified from net.http_post() from extensions.http_post(). But I really need some advice from messing with this stuff
garyaustin
garyaustin2d ago
All jobs should be using net.http_post() either way. Never extensions.http_post. You won't get Supabase employee support here. You should be able to use the UI to disable and re-enable pg_net. The net.http_post works just like it did before. pg_net creates its own net extension independent of where you install it.
lavik17
lavik17OP23h ago
got it. I'm referring to Claude because I am really new at this. He is saying that if I want to keep using net_http_post() without referring to extensions then I should create a wrapper :
CREATE OR REPLACE FUNCTION net.http_post(
url TEXT,
headers JSONB DEFAULT '{}'::jsonb,
body JSONB DEFAULT '{}'::jsonb
) RETURNS RECORD
LANGUAGE SQL
AS $$
SELECT extensions.http_post(url, headers, body);
$$;
CREATE OR REPLACE FUNCTION net.http_post(
url TEXT,
headers JSONB DEFAULT '{}'::jsonb,
body JSONB DEFAULT '{}'::jsonb
) RETURNS RECORD
LANGUAGE SQL
AS $$
SELECT extensions.http_post(url, headers, body);
$$;
is it really needed?
garyaustin
garyaustin18h ago
Claude is wrong. You don't use extensions.http_post for pg_net. You should have been using net.http_post before and you should be using net.http_post after. pg_net is odd that it creates its own schema net and installs functions and tables there.
lavik17
lavik17OP15h ago
Thank you so much @garyaustin !! so to make sure I got it all: I should be moving the pg_net from public to extensions but not chnage anything in the cron jobs. is this correct?
garyaustin
garyaustin15h ago
If your cron is calling net.xxxx then you leave it that way.
garyaustin
garyaustin15h ago
Then I would just change it here:
No description
lavik17
lavik17OP12h ago
Thank you !! 🙏

Did you find this page helpful?