Help Center/ GaussDB(DWS)/ Troubleshooting/ Account/Permission/Password/ An Error Message Is Reported During Statement Execution, Indicating that the User Does Not Have the Required Permission
Updated on 2024-03-04 GMT+08:00

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

  1. 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.
      1
      GRANT USAGE ON SCHEMA tom TO jerry;
      
    • Grant the SELECT permission on the tables created by user tom to user jerry.
      1
      GRANT 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.
      1
      ALTER DEFAULT PRIVILEGES FOR USER tom IN SCHEMA tom GRANT SELECT ON TABLE TO jerry;