By default, the creator of a table is automatically its owner . The owner has all rights that can be associated with a table, in addition to the ability to grant and revoke rights with the GRANT and REVOKE keywords (see the section called Privileges in Chapter 8 ). If ownership must be changed, the OWNER clause may be passed to ALTER TABLE . The syntax to change the ownership of a table from one user to another is:
ALTER TABLE table_name OWNER TO new_owner
The preceding syntax describes how to change ownership of a table, where table_name is the name of the table whose ownership you wish to modify, and new_owner is the valid PostgreSQL username that you wish to transfer ownership of the table to.
Example 4-12. Changing Table Ownership
booktown=# ALTER TABLE employees booktown-# OWNER TO corwin; ALTER
|Rights to Change Ownership|
In order to change the ownership of a table, you must either be the owner of that table, or a PostgreSQL superuser .