Appearance
ALTER SCHEMA
Alter attributes of an existing schema. You can change the owner of a schema, change its name, and set the size of or disable disk quota.
ALTER SCHEMA name OWNER TO { new_owner | CURRENT_USER | SESSION_USER }
ALTER SCHEMA name RENAME TO new_name
ALTER SCHEMA name SET MAX_SIZE [=] 'size'
ALTER SCHEMA name SET MAX_SIZE DISABLE
- OWNER TO
- Change the owner of a schema. See CURRENT_USER and SESSION_USER.
- RENAME TO
- Rename a schema.
- SET MAX_SIZE [=] 'size'
- Specify the maximum amount of space an individual schema may use, where
'size'
is the number of bytes.'size'
must be a positive integer with the possible inclusion of units: MB, GB, or TB. If units are included, the command will be accepted with and without a space between the integer and unit. - SET MAX_SIZE DISABLE
- Disable the disk usage limit for the specified schema.
For example, rename a schema, then change its owner. The new owner must be an existing database user.
premdb=# alter schema premdb rename to newprem;
ALTER SCHEMA
premdb=# alter schema newprem owner to bobr;
ALTER SCHEMA
For example, set a quota for a schema:
premdb=# alter schema prembd set max_size='1GB';
ALTER SCHEMA
Parent topic:SQL Commands