1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Allow SQL:2008 syntax ALTER TABLE ... ALTER COLUMN ... SET DATA TYPE

alongside our traditional syntax.
This commit is contained in:
Peter Eisentraut
2008-10-21 08:38:16 +00:00
parent 089ae3bc9a
commit 1471e3843d
9 changed files with 76 additions and 32 deletions

View File

@ -1,5 +1,5 @@
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/alter_table.sgml,v 1.99 2008/05/09 23:32:03 tgl Exp $
$PostgreSQL: pgsql/doc/src/sgml/ref/alter_table.sgml,v 1.100 2008/10/21 08:38:15 petere Exp $
PostgreSQL documentation
-->
@ -33,7 +33,7 @@ where <replaceable class="PARAMETER">action</replaceable> is one of:
ADD [ COLUMN ] <replaceable class="PARAMETER">column</replaceable> <replaceable class="PARAMETER">type</replaceable> [ <replaceable class="PARAMETER">column_constraint</replaceable> [ ... ] ]
DROP [ COLUMN ] <replaceable class="PARAMETER">column</replaceable> [ RESTRICT | CASCADE ]
ALTER [ COLUMN ] <replaceable class="PARAMETER">column</replaceable> TYPE <replaceable class="PARAMETER">type</replaceable> [ USING <replaceable class="PARAMETER">expression</replaceable> ]
ALTER [ COLUMN ] <replaceable class="PARAMETER">column</replaceable> [ SET DATA ] TYPE <replaceable class="PARAMETER">type</replaceable> [ USING <replaceable class="PARAMETER">expression</replaceable> ]
ALTER [ COLUMN ] <replaceable class="PARAMETER">column</replaceable> SET DEFAULT <replaceable class="PARAMETER">expression</replaceable>
ALTER [ COLUMN ] <replaceable class="PARAMETER">column</replaceable> DROP DEFAULT
ALTER [ COLUMN ] <replaceable class="PARAMETER">column</replaceable> { SET | DROP } NOT NULL
@ -93,7 +93,7 @@ where <replaceable class="PARAMETER">action</replaceable> is one of:
</varlistentry>
<varlistentry>
<term><literal>ALTER COLUMN TYPE</literal></term>
<term><literal>SET DATA TYPE</literal></term>
<listitem>
<para>
This form changes the type of a column of a table. Indexes and
@ -760,7 +760,7 @@ ALTER TABLE distributors
with time zone</type> via a <literal>USING</literal> clause:
<programlisting>
ALTER TABLE foo
ALTER COLUMN foo_timestamp TYPE timestamp with time zone
ALTER COLUMN foo_timestamp SET DATA TYPE timestamp with time zone
USING
timestamp with time zone 'epoch' + foo_timestamp * interval '1 second';
</programlisting>
@ -868,8 +868,9 @@ ALTER TABLE myschema.distributors SET SCHEMA yourschema;
<title>Compatibility</title>
<para>
The <literal>ADD</literal>, <literal>DROP</>, and <literal>SET DEFAULT</>
forms conform with the SQL standard. The other forms are
The forms <literal>ADD</literal>, <literal>DROP</>, <literal>SET DEFAULT</>,
and <literal>SET DATA TYPE</literal> (without <literal>USING</literal>)
conform with the SQL standard. The other forms are
<productname>PostgreSQL</productname> extensions of the SQL standard.
Also, the ability to specify more than one manipulation in a single
<command>ALTER TABLE</> command is an extension.