mirror of
https://github.com/postgres/postgres.git
synced 2025-09-09 13:09:39 +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:
@@ -57,10 +57,7 @@ ALTER TYPE planets ADD VALUE 'pluto' AFTER 'zeus';
|
||||
-- if not exists tests
|
||||
|
||||
-- existing value gives error
|
||||
|
||||
-- We can't do this test because the error contains the
|
||||
-- offending Oid value, which is unpredictable.
|
||||
-- ALTER TYPE planets ADD VALUE 'mercury';
|
||||
ALTER TYPE planets ADD VALUE 'mercury';
|
||||
|
||||
-- unless IF NOT EXISTS is specified
|
||||
ALTER TYPE planets ADD VALUE IF NOT EXISTS 'mercury';
|
||||
@@ -73,7 +70,6 @@ ALTER TYPE planets ADD VALUE IF NOT EXISTS 'pluto';
|
||||
-- should be pluto, i.e. the new value
|
||||
SELECT enum_last(NULL::planets);
|
||||
|
||||
|
||||
--
|
||||
-- Test inserting so many values that we have to renumber
|
||||
--
|
||||
|
Reference in New Issue
Block a user