Changing Sequence Ownership

The ALTER SEQUENCE command lets you change the attributes of an existing sequence. All changes take effect immediately, within the same session. Any parameters not set during an ALTER SEQUENCE statement retain their prior settings.

If you need to change sequence ownership, such as if an employee who owns a sequence leaves the company, you can do so with the following ALTER SEQUENCE syntax:

=> ALTER SEQUENCE sequence-name OWNER TO new-owner-name;

This operation immediately reassigns the sequence from the current owner to the specified new owner.

Only the sequence owner or a superuser can change ownership, and reassignment does not transfer grants from the original owner to the new owner; grants made by the original owner are dropped.

Note: Renaming a table owner transfers ownership of dependent sequence objects (associated IDENTITY/AUTO-INCREMENT sequences) but does not transfer ownership of other referenced sequences. See Changing Table Ownership.

Example

The following example reassigns sequence ownership from the current owner to user Bob:

=> ALTER SEQUENCE sequential OWNER TO Bob;

See ALTER SEQUENCE in the SQL Reference Manual for details.