<!--
doc/src/sgml/ref/alter_tablespace.sgml
PostgreSQL documentation
-->
<refentry id="sql-altertablespace">
<indexterm zone="sql-altertablespace">
<primary>ALTER TABLESPACE</primary>
</indexterm>
<refmeta>
<refentrytitle>ALTER TABLESPACE</refentrytitle>
<manvolnum>7</manvolnum>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>ALTER TABLESPACE</refname>
<refpurpose>change the definition of a tablespace</refpurpose>
</refnamediv>
<refsynopsisdiv>
<synopsis>
ALTER TABLESPACE <replaceable>name</replaceable> RENAME TO <replaceable>new_name</replaceable>
ALTER TABLESPACE <replaceable>name</replaceable> OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
ALTER TABLESPACE <replaceable>name</replaceable> SET ( <replaceable class="parameter">tablespace_option</replaceable> = <replaceable class="parameter">value</replaceable> [, ... ] )
ALTER TABLESPACE <replaceable>name</replaceable> RESET ( <replaceable class="parameter">tablespace_option</replaceable> [, ... ] )
</synopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para>
<command>ALTER TABLESPACE</command> can be used to change the definition of
a tablespace.
</para>
<para>
You must own the tablespace to change the definition of a tablespace.
To alter the owner, you must also be able to <literal>SET ROLE</literal>
to the new owning role.
(Note that superusers have these privileges automatically.)
</para>
</refsect1>
<refsect1>
<title>Parameters</title>
<variablelist>
<varlistentry>
<term><replaceable class="parameter">name</replaceable></term>
<listitem>
<para>
The name of an existing tablespace.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">new_name</replaceable></term>
<listitem>
<para>
The new name of the tablespace. The new name cannot
begin with <literal>pg_</literal>, as such names
are reserved for system tablespaces.
</para>
</listitem>
</varlistentry>