Monday, November 3, 2014

Postgres INSERT ERROR: permission denied for schema public

Assuming the username is testing, you probably want to do:
GRANT ALL ON schema public TO testing;
Note about granting ALL PRIVILEGES: you don't say on what this GRANT command was applied. Assuming it was ON DATABASE..., it just means CONNECT, CREATE and TEMP privileges, nothing about the public schema or any other contained object, which is why it "doesn't work".
EDIT: when that's not sufficient
If the tables referenced by the foreign keys are not owned by testing, their owner needs also to have the USAGE privilege on the schema in order to look up the referenced tables.
It's not obvious from the result of \dp (the result of \d would tell for sure) but if category is owned by super and that user also has no privilege on the schema, you'd need to assign it with:
GRANT USAGE ON schema public TO super;

No comments:

Post a Comment