diff options
author | Tomas Vondra | 2017-07-16 14:22:46 +0000 |
---|---|---|
committer | Tomas Vondra | 2017-07-16 14:22:46 +0000 |
commit | 6b9779ddbed864b0cbccafa973a8f84215689f2d (patch) | |
tree | 3df1d2fbfbe06a24ea826fe2e37118c9359d8125 | |
parent | e0ebb632a977982f23edbef56ca5a503e1d7f0bc (diff) |
Modify enum tests to not rely on SAVEPOINT
Postgres-XL does not support SAVEPOINT (or subtransactions in general).
Some regression tests use this to test cases that are expected to fail,
and we want to keep testing that. So instead of removing the tests,
split them into independent transactions (and tweak the expected output
accordingly).
Note: The tests are still failing, though. Apparently XL does not undo
the effect of ALTER TYPE ... ADD VALUE on rollback.
-rw-r--r-- | src/test/regress/expected/enum.out | 21 | ||||
-rw-r--r-- | src/test/regress/sql/enum.sql | 13 |
2 files changed, 19 insertions, 15 deletions
diff --git a/src/test/regress/expected/enum.out b/src/test/regress/expected/enum.out index 1d4e28177a..1f6f267d23 100644 --- a/src/test/regress/expected/enum.out +++ b/src/test/regress/expected/enum.out @@ -585,13 +585,14 @@ CREATE TYPE bogus AS ENUM('good'); -- but we can't use them BEGIN; ALTER TYPE bogus ADD VALUE 'new'; -SAVEPOINT x; SELECT 'new'::bogus; -- unsafe ERROR: unsafe use of new value "new" of enum type bogus LINE 1: SELECT 'new'::bogus; ^ HINT: New enum values must be committed before they can be used. -ROLLBACK TO x; +ROLLBACK; +BEGIN; +ALTER TYPE bogus ADD VALUE 'new'; SELECT enum_first(null::bogus); -- safe enum_first ------------ @@ -601,18 +602,17 @@ SELECT enum_first(null::bogus); -- safe SELECT enum_last(null::bogus); -- unsafe ERROR: unsafe use of new value "new" of enum type bogus HINT: New enum values must be committed before they can be used. -ROLLBACK TO x; +ROLLBACK; +BEGIN; +ALTER TYPE bogus ADD VALUE 'new'; SELECT enum_range(null::bogus); -- unsafe ERROR: unsafe use of new value "new" of enum type bogus HINT: New enum values must be committed before they can be used. -ROLLBACK TO x; COMMIT; SELECT 'new'::bogus; -- now safe - bogus -------- - new -(1 row) - +ERROR: invalid input value for enum bogus: "new" +LINE 1: SELECT 'new'::bogus; + ^ SELECT enumlabel, enumsortorder FROM pg_enum WHERE enumtypid = 'bogus'::regtype @@ -620,8 +620,7 @@ ORDER BY 2; enumlabel | enumsortorder -----------+--------------- good | 1 - new | 2 -(2 rows) +(1 row) -- check that we recognize the case where the enum already existed but was -- modified in the current txn; this should not be considered safe diff --git a/src/test/regress/sql/enum.sql b/src/test/regress/sql/enum.sql index b103b002bd..d983de894b 100644 --- a/src/test/regress/sql/enum.sql +++ b/src/test/regress/sql/enum.sql @@ -277,15 +277,20 @@ CREATE TYPE bogus AS ENUM('good'); -- but we can't use them BEGIN; ALTER TYPE bogus ADD VALUE 'new'; -SAVEPOINT x; SELECT 'new'::bogus; -- unsafe -ROLLBACK TO x; +ROLLBACK; + +BEGIN; +ALTER TYPE bogus ADD VALUE 'new'; SELECT enum_first(null::bogus); -- safe SELECT enum_last(null::bogus); -- unsafe -ROLLBACK TO x; +ROLLBACK; + +BEGIN; +ALTER TYPE bogus ADD VALUE 'new'; SELECT enum_range(null::bogus); -- unsafe -ROLLBACK TO x; COMMIT; + SELECT 'new'::bogus; -- now safe SELECT enumlabel, enumsortorder FROM pg_enum |