An Error Message Is Reported During Statement Execution, Indicating that the User Does Not Have the Required Permission
Symptom
The following error message is displayed after statement execution.
1 | ERROR: permission denied for xxx |
Possible Causes
The user does not have the corresponding permission and cannot access or perform operations on the table or schema.
Handling Procedure
- Grant permissions to tables or schemas using GRANT. If you want user jerry to have the query permission on all tables created by tom and the tables to be created, perform the following operations:
- Grant the schema permissions of user tom to user jerry.
1grant usage on schema tom to jerry;
- Grant the SELECT permission on the tables created by user tom to user jerry.
1grant select on all tables in schema tom to jerry;
- Grant the SELECT permission on the tables created by user tom in the schema with the same name to user jerry.
1alter default privileges for user tom in schema tom grant select on tables to jerry;
- Grant the schema permissions of user tom to user jerry.
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.