blob: e805268946f4b4c0d90b9dbe8b82e35471088779 [file] [log] [blame]
---
title: ALTER TABLESPACE
---
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
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)