2 $PostgreSQL: pgsql/doc/src/sgml/ref/alter_index.sgml,v 1.6 2005/08/22 19:39:52 tgl Exp $
3 PostgreSQL documentation
6 <refentry id="SQL-ALTERINDEX">
8 <refentrytitle id="sql-alterindex-title">ALTER INDEX</refentrytitle>
9 <refmiscinfo>SQL - Language Statements</refmiscinfo>
13 <refname>ALTER INDEX</refname>
14 <refpurpose>change the definition of an index</refpurpose>
17 <indexterm zone="sql-alterindex">
18 <primary>ALTER INDEX</primary>
23 ALTER INDEX <replaceable class="PARAMETER">name</replaceable> RENAME TO <replaceable class="PARAMETER">new_name</replaceable>
24 ALTER INDEX <replaceable class="PARAMETER">name</replaceable> SET TABLESPACE <replaceable class="PARAMETER">tablespace_name</replaceable>
29 <title>Description</title>
32 <command>ALTER INDEX</command> changes the definition of an existing index.
33 There are several subforms:
38 <term><literal>RENAME</literal></term>
41 The <literal>RENAME</literal> form changes the name of the index.
42 There is no effect on the stored data.
48 <term><literal>SET TABLESPACE</literal></term>
51 This form changes the index's tablespace to the specified tablespace and
52 moves the data file(s) associated with the index to the new tablespace.
54 <xref linkend="SQL-CREATETABLESPACE" endterm="sql-createtablespace-title">.
65 <title>Parameters</title>
70 <term><replaceable class="PARAMETER">name</replaceable></term>
73 The name (possibly schema-qualified) of an existing index to
80 <term><replaceable class="PARAMETER">new_name</replaceable></term>
83 New name for the index.
89 <term><replaceable class="PARAMETER">tablespace_name</replaceable></term>
92 The tablespace to which the index will be moved.
104 These operations are also possible using
105 <xref linkend="SQL-ALTERTABLE" endterm="SQL-ALTERTABLE-TITLE">.
106 <command>ALTER INDEX</> is in fact just an alias for the forms
107 of <command>ALTER TABLE</> that apply to indexes.
111 There was formerly an <command>ALTER INDEX OWNER</> variant, but
112 this is now ignored (with a warning). An index cannot have an owner
113 different from its table's owner. Changing the table's owner
114 automatically changes the index as well.
118 Changing any part of a system catalog index is not permitted.
123 <title>Examples</title>
125 To rename an existing index:
127 ALTER INDEX distributors RENAME TO suppliers;
132 To move an index to a different tablespace:
134 ALTER INDEX distributors SET TABLESPACE fasttablespace;
141 <title>Compatibility</title>
144 <command>ALTER INDEX</> is a <productname>PostgreSQL</productname>
150 <!-- Keep this comment at the end of the file
155 sgml-minimize-attributes:nil
156 sgml-always-quote-attributes:t
159 sgml-parent-document:nil
160 sgml-default-dtd-file:"../reference.ced"
161 sgml-exposed-tags:nil
162 sgml-local-catalogs:"/usr/lib/sgml/catalog"
163 sgml-local-ecat-files:nil