Help Center> Relational Database Service> FAQs> Database Permission> Why Is An Error Reported When I Attempt to Change a Table Owner of My RDS for PostgreSQL Instance?
Updated on 2024-05-13 GMT+08:00

Why Is An Error Reported When I Attempt to Change a Table Owner of My RDS for PostgreSQL Instance?

Symptom

An error is reported when the owner of a table named mytable is being changed to user test. The table is in the my_db database created by user root.

ALTER TABLE mytable OWNER TO test;

Possible Causes

The error is displayed because user root has not escalated the privilege.

After the privilege is escalated, user root has the permission to assign the table owner to another user.

Solution

  1. Log in to the database as user test.
  2. Run the following command as user test:

    GRANT test TO root;

  3. Log in to the database as user root.
  4. Run the following command as user root to change the owner of the mytable table:

    ALTER TABLE mytable OWNER TO test;

Database Permission FAQs

more