pgsql: Allow IF NOT EXISTS when add a new enum label.

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Allow IF NOT EXISTS when add a new enum label.
Date: 2012-09-22 17:02:41
Message-ID: E1TFT6H-0003oc-1d@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/6d12b68cd7a93e279c8c690749b334c9f59ac7fa

Modified Files
--------------
doc/src/sgml/ref/alter_type.sgml | 9 +++++++--
src/backend/catalog/pg_enum.c | 18 +++++++++++++++++-
src/backend/commands/typecmds.c | 3 ++-
src/backend/nodes/copyfuncs.c | 1 +
src/backend/nodes/equalfuncs.c | 1 +
src/backend/parser/gram.y | 25 ++++++++++++++++---------
src/include/catalog/pg_enum.h | 3 ++-
src/include/nodes/parsenodes.h | 1 +
src/test/regress/expected/enum.out | 22 ++++++++++++++++++++++
src/test/regress/sql/enum.sql | 20 ++++++++++++++++++++
10 files changed, 89 insertions(+), 14 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Andrew Dunstan 2012-09-22 17:57:50 pgsql: Fix docs typo
Previous Message Tom Lane 2012-09-21 23:03:33 pgsql: Improve ruleutils.c's heuristics for dealing with rangetable ali