1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Minor corrections for ALTER TYPE ADD VALUE IF NOT EXISTS patch.

Produce a NOTICE when the label already exists, for consistency with other
CREATE IF NOT EXISTS commands.  Also, fix the code so it produces something
more user-friendly than an index violation when the label already exists.
This not incidentally enables making a regression test that the previous
patch didn't make for fear of exposing an unpredictable OID in the results.
Also some wordsmithing on the documentation.
This commit is contained in:
Tom Lane
2012-09-22 18:35:22 -04:00
parent fcc1576687
commit 31510194cc
5 changed files with 33 additions and 25 deletions

View File

@ -109,15 +109,16 @@ ALTER TYPE <replaceable class="PARAMETER">name</replaceable> ADD VALUE [ IF NOT
<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
the enum's ordering is not specified using <literal>BEFORE</literal> or
<literal>AFTER</literal>, then the new item is placed at the end of the
list of values.
This form adds a new value to an enum type. The new value's place in
the enum's ordering can be specified as being <literal>BEFORE</literal>
or <literal>AFTER</literal> one of the existing values. Otherwise,
the new item is added 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.
If <literal>IF NOT EXISTS</literal> is specified, it is not an error if
the type already contains the new value: a notice is issued but no other
action is taken. Otherwise, an error will occur if the new value is
already present.
</para>
</listitem>
</varlistentry>