Skip to content

db_pre_request issues in private schema #3023

Answered by cam-mcevenue
cam-mcevenue asked this question in Q&A
Discussion options

You must be logged in to vote

I figured out how to get this to work. Though I'm not exactly clear why. I think it has something to do with how authenticator switches into anon and authenticated roles (or whatever web_user and anon roles you've setup. These are the target roles in supabase)

In order to have the db_request_function in a private schema, you must grant the following:

create schema "private";

grant usage on schema private to authenticator, anon, authenticated;
alter default privileges for role "postgres" in schema "private" grant all on functions to authenticator, anon, authenticated;

create or replace function private.test() returns void
  language plpgsql
  security definer
  as $$
begin
    if not (cu…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@cam-mcevenue
Comment options

@cam-mcevenue
Comment options

Answer selected by cam-mcevenue
@laurenceisla
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants