diff options
author | Andrew Dunstan <andrew@dunslane.net> | 2012-09-22 12:53:31 -0400 |
---|---|---|
committer | Andrew Dunstan <andrew@dunslane.net> | 2012-09-22 12:53:31 -0400 |
commit | 6d12b68cd7a93e279c8c690749b334c9f59ac7fa (patch) | |
tree | fadc9d82179c4ad7cd49198c97208b17e9db45bc /doc/src | |
parent | 11e131854f8231a21613f834c40fe9d046926387 (diff) | |
download | postgresql-6d12b68cd7a93e279c8c690749b334c9f59ac7fa.tar.gz postgresql-6d12b68cd7a93e279c8c690749b334c9f59ac7fa.zip |
Allow IF NOT EXISTS when add a new enum label.
If the label is already in the enum the statement becomes a no-op.
This will reduce the pain that comes from our not allowing this
operation inside a transaction block.
Andrew Dunstan, reviewed by Tom Lane and Magnus Hagander.
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/ref/alter_type.sgml | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/doc/src/sgml/ref/alter_type.sgml b/doc/src/sgml/ref/alter_type.sgml index 6386085a608..1ff53923fb6 100644 --- a/doc/src/sgml/ref/alter_type.sgml +++ b/doc/src/sgml/ref/alter_type.sgml @@ -28,7 +28,7 @@ ALTER TYPE <replaceable class="PARAMETER">name</replaceable> OWNER TO <replaceab ALTER TYPE <replaceable class="PARAMETER">name</replaceable> RENAME ATTRIBUTE <replaceable class="PARAMETER">attribute_name</replaceable> TO <replaceable class="PARAMETER">new_attribute_name</replaceable> ALTER TYPE <replaceable class="PARAMETER">name</replaceable> RENAME TO <replaceable class="PARAMETER">new_name</replaceable> [ CASCADE | RESTRICT ] ALTER TYPE <replaceable class="PARAMETER">name</replaceable> SET SCHEMA <replaceable class="PARAMETER">new_schema</replaceable> -ALTER TYPE <replaceable class="PARAMETER">name</replaceable> ADD VALUE <replaceable class="PARAMETER">new_enum_value</replaceable> [ { BEFORE | AFTER } <replaceable class="PARAMETER">existing_enum_value</replaceable> ] +ALTER TYPE <replaceable class="PARAMETER">name</replaceable> ADD VALUE [ IF NOT EXISTS ] <replaceable class="PARAMETER">new_enum_value</replaceable> [ { BEFORE | AFTER } <replaceable class="PARAMETER">existing_enum_value</replaceable> ] <phrase>where <replaceable class="PARAMETER">action</replaceable> is one of:</phrase> @@ -106,7 +106,7 @@ ALTER TYPE <replaceable class="PARAMETER">name</replaceable> ADD VALUE <replacea </varlistentry> <varlistentry> - <term><literal>ADD VALUE [ BEFORE | AFTER ]</literal></term> + <term><literal>ADD VALUE [ IF NOT EXISTS ] [ BEFORE | AFTER ]</literal></term> <listitem> <para> This form adds a new value to an enum type. If the new value's place in @@ -114,6 +114,11 @@ ALTER TYPE <replaceable class="PARAMETER">name</replaceable> ADD VALUE <replacea <literal>AFTER</literal>, then the new item is placed at the end of the list of values. </para> + <para> + If <literal>IF NOT EXISTS</literal is used, it is not an error if the + type already contains the new value, and no action is taken. Otherwise, + an error will occur if the new value is already present. + </para> </listitem> </varlistentry> |