Anyone know if it's possible to create a procedure...
# sql
d
Anyone know if it's possible to create a procedure that's only callable with the service role?
s
You should be able to, but I haven’t tested this personally as yet. When I get back at my computer I will check.
d
Awesome, thank you!
k
You can do that using schemas, just check what auth.users table is actually under and use that schema too for your function. Something like Create or replace function myschema.my_function_name()
d
ahh, nice! great idea
It uses auth schema.
s
Be careful of adding tables and functions
k
Definitely, but its completely fine if using service role token which is what its meant for :)
s
These are schemas created by the Supabase team and could be modified in the future for upgrade purposes
k
How would you recommend that then? Creating new schema and grant it superuser?
s
Yes, but do note that the role of super user is being recommended against in the latest Postgres if I remember correctly