OWNER is not a standalone SQL statement but a clause used in several PostgreSQL commands (and dialects derived from it) to assign or transfer ownership of a database object to a different role. Ownership implies full privilege over an object and the right to grant privileges to others. Common commands that include OWNER are ALTER TABLE, ALTER VIEW, ALTER SEQUENCE, ALTER DATABASE, ALTER FUNCTION, CREATE SCHEMA, and CREATE DATABASE. Only a superuser or the current owner can change an object’s owner. When ownership changes, any default privileges tied to the old owner remain unchanged unless explicitly re-granted. Some objects (for example, system catalogs) cannot have their owner changed.
object_name
(identifier) - Name of the table, view, sequence, or other object whose ownership is being changednew_owner
(role name) - Target role that will become the new ownerALTER TABLE, ALTER DATABASE, GRANT, REVOKE, CREATE SCHEMA, ROLE, PRIVILEGES
PostgreSQL 7.3
The command can be executed by the current owner of the object or by a superuser. Regular roles without ownership cannot transfer ownership.
No. Any explicit GRANTs remain unchanged. The new owner automatically has full rights; the old owner loses implicit rights but keeps any separate GRANTed privileges.
OWNER is PostgreSQL specific. Other systems like SQL Server use ALTER AUTHORIZATION, while MySQL lacks an equivalent command.
Generate ALTER TABLE statements via psql meta-commands or a DO block that loops through pg_class entries, then run them in a single transaction.