Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

ERROR: permission denied for table accounts postgresql 13

CREATE OR REPLACE FUNCTION auto_grant_func()
RETURNS event_trigger AS $$
BEGIN
    grant all on all tables in schema public to <username>;
    grant all on all sequences in schema public to <username>;
    grant select on all tables in schema public to <username>;
    grant select on all sequences in schema public to <username>;
END;
$$ LANGUAGE plpgsql;

CREATE EVENT TRIGGER auto_grant_trigger
    ON ddl_command_end
    WHEN TAG IN ('CREATE TABLE', 'CREATE TABLE AS')
EXECUTE PROCEDURE auto_grant_func();
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #permission #denied #table #accounts #postgresql
ADD COMMENT
Topic
Name
1+6 =