| --- |
| title: ALTER TABLESPACE |
| --- |
| |
| Changes the definition of a tablespace. |
| |
| ## <a id="synopsis"></a>Synopsis |
| |
| ``` pre |
| ALTER TABLESPACE <name> RENAME TO <newname> |
| |
| ALTER TABLESPACE <name> OWNER TO <newowner> |
| |
| ``` |
| |
| ## <a id="desc"></a>Description |
| |
| `ALTER TABLESPACE` changes the definition of a tablespace. |
| |
| You must own the tablespace to use `ALTER TABLESPACE`. To alter the owner, you must also be a direct or indirect member of the new owning role. (Note that superusers have these privileges automatically.) |
| |
| ## <a id="altertablespace__section4"></a>Parameters |
| |
| <dt> \<name\> </dt> |
| <dd>The name of an existing tablespace.</dd> |
| |
| <dt> \<newname\> </dt> |
| <dd>The new name of the tablespace. The new name cannot begin with *pg\_* (reserved for system tablespaces).</dd> |
| |
| <dt> \<newowner\> </dt> |
| <dd>The new owner of the tablespace.</dd> |
| |
| ## <a id="altertablespace__section5"></a>Examples |
| |
| Rename tablespace `index_space` to `fast_raid`: |
| |
| ``` pre |
| ALTER TABLESPACE index_space RENAME TO fast_raid; |
| ``` |
| |
| Change the owner of tablespace `index_space`: |
| |
| ``` pre |
| ALTER TABLESPACE index_space OWNER TO mary; |
| ``` |
| |
| ## <a id="altertablespace__section6"></a>Compatibility |
| |
| There is no `ALTER TABLESPACE` statement in the SQL standard. |
| |
| ## <a id="see"></a> See Also |
| |
| [CREATE TABLESPACE](CREATE-TABLESPACE.html), [DROP TABLESPACE](DROP-TABLESPACE.html) |
| |
| |