diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/test/regress/expected/domain.out | 14 | ||||
-rw-r--r-- | src/test/regress/sql/domain.sql | 11 |
2 files changed, 25 insertions, 0 deletions
diff --git a/src/test/regress/expected/domain.out b/src/test/regress/expected/domain.out index f65b66345ab..42b6559f9c8 100644 --- a/src/test/regress/expected/domain.out +++ b/src/test/regress/expected/domain.out @@ -743,6 +743,20 @@ update domnotnull set col1 = null; -- fails ERROR: domain dnotnulltest does not allow null values alter domain dnotnulltest drop not null; update domnotnull set col1 = null; +update domnotnull set col1 = 5; +-- these constraints can also be added and removed by name +alter domain dnotnulltest add constraint dnotnulltest_notnull not null; +update domnotnull set col1 = null; -- fails +ERROR: domain dnotnulltest does not allow null values +select conname, pg_get_constraintdef(oid) from pg_constraint + where contypid = 'dnotnulltest'::regtype; + conname | pg_get_constraintdef +----------------------+---------------------- + dnotnulltest_notnull | NOT NULL +(1 row) + +alter domain dnotnulltest drop constraint dnotnulltest_notnull; +update domnotnull set col1 = null; drop domain dnotnulltest cascade; NOTICE: drop cascades to 2 other objects DETAIL: drop cascades to column col2 of table domnotnull diff --git a/src/test/regress/sql/domain.sql b/src/test/regress/sql/domain.sql index b5a70ee8be7..ee07b03174e 100644 --- a/src/test/regress/sql/domain.sql +++ b/src/test/regress/sql/domain.sql @@ -429,6 +429,17 @@ alter domain dnotnulltest drop not null; update domnotnull set col1 = null; +update domnotnull set col1 = 5; + +-- these constraints can also be added and removed by name +alter domain dnotnulltest add constraint dnotnulltest_notnull not null; +update domnotnull set col1 = null; -- fails +select conname, pg_get_constraintdef(oid) from pg_constraint + where contypid = 'dnotnulltest'::regtype; + +alter domain dnotnulltest drop constraint dnotnulltest_notnull; +update domnotnull set col1 = null; + drop domain dnotnulltest cascade; -- Test ALTER DOMAIN .. DEFAULT .. |