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

Started by Andrew Dunstanalmost 14 years ago1 messagescomitters
Jump to latest
#1Andrew Dunstan
andrew@dunslane.net

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(-)