From 6d12b68cd7a93e279c8c690749b334c9f59ac7fa Mon Sep 17 00:00:00 2001 From: Andrew Dunstan Date: Sat, 22 Sep 2012 12:53:31 -0400 Subject: 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. --- src/include/catalog/pg_enum.h | 3 ++- src/include/nodes/parsenodes.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src/include') diff --git a/src/include/catalog/pg_enum.h b/src/include/catalog/pg_enum.h index 91c1ab1de7d..8842a8706b5 100644 --- a/src/include/catalog/pg_enum.h +++ b/src/include/catalog/pg_enum.h @@ -65,6 +65,7 @@ typedef FormData_pg_enum *Form_pg_enum; extern void EnumValuesCreate(Oid enumTypeOid, List *vals); extern void EnumValuesDelete(Oid enumTypeOid); extern void AddEnumLabel(Oid enumTypeOid, const char *newVal, - const char *neighbor, bool newValIsAfter); + const char *neighbor, bool newValIsAfter, + bool skipIfExists); #endif /* PG_ENUM_H */ diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h index 19178b55512..98fe850c927 100644 --- a/src/include/nodes/parsenodes.h +++ b/src/include/nodes/parsenodes.h @@ -2306,6 +2306,7 @@ typedef struct AlterEnumStmt char *newVal; /* new enum value's name */ char *newValNeighbor; /* neighboring enum value, if specified */ bool newValIsAfter; /* place new enum value after neighbor? */ + bool skipIfExists; /* ignore statement if label already exists */ } AlterEnumStmt; /* ---------------------- -- cgit v1.2.3