File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -300,3 +300,17 @@ drop domain ddef2 restrict;
300300drop domain ddef3 restrict;
301301drop domain ddef4 restrict;
302302drop domain ddef5 restrict;
303+ -- Make sure that constraints of newly-added domain columns are
304+ -- enforced correctly, even if there's no default value for the new
305+ -- column. Per bug #1433
306+ create domain str_domain as text not null;
307+ create table domain_test (a int, b int);
308+ insert into domain_test values (1, 2);
309+ insert into domain_test values (1, 2);
310+ -- should fail
311+ alter table domain_test add column c str_domain;
312+ ERROR: domain str_domain does not allow null values
313+ create domain str_domain2 as text check (value <> 'foo') default 'foo';
314+ -- should fail
315+ alter table domain_test add column d str_domain2;
316+ ERROR: value for domain str_domain2 violates check constraint "str_domain2_check"
Original file line number Diff line number Diff line change @@ -244,3 +244,21 @@ drop domain ddef2 restrict;
244244drop domain ddef3 restrict;
245245drop domain ddef4 restrict;
246246drop domain ddef5 restrict;
247+
248+ -- Make sure that constraints of newly-added domain columns are
249+ -- enforced correctly, even if there's no default value for the new
250+ -- column. Per bug #1433
251+ create domain str_domain as text not null ;
252+
253+ create table domain_test (a int , b int );
254+
255+ insert into domain_test values (1 , 2 );
256+ insert into domain_test values (1 , 2 );
257+
258+ -- should fail
259+ alter table domain_test add column c str_domain;
260+
261+ create domain str_domain2 as text check (value <> ' foo' ) default ' foo' ;
262+
263+ -- should fail
264+ alter table domain_test add column d str_domain2;
You can’t perform that action at this time.
0 commit comments