Commands
ALTER DATABASE
The ALTER DATABASE
command modifies the definition of a database.
Syntax
alter_option
depends on the operation you want to perform on the database. For all supported clauses, see the sections below.
Clause
OWNER TO
Parameter or clause | Description |
---|---|
OWNER TO | This clause changes the owner of the database. To alter the owner, you must be able to SET ROLE to the new owning role, and you must have the CREATEDB privilege. Note that superusers have all these privileges automatically. |
new_user | The new owner you want to assign to the database. |
RENAME TO
Parameter or clause | Description |
---|---|
RENAME TO | This clause changes the name of the database. Only the database owner or a superuser can rename a database; non-superuser owners must also have the CREATEDB privilege. The current database cannot be renamed. (Connect to a different database if you need to do that.) |
new_name | The new name of the database. |
Was this page helpful?