[ Previous patch reversed.]

Please use this patch instead of my previously submitted one.

It is just remerged against HEAD for new alter_table.out stuff.

Another reason this patch is useful for _interactive_ users: imagine a
view based on a many way join.  Imagine creating a complicated insert
rule that inserts into all the joined tables and when you insert you get
a check failure, but you need to know which actual table the constraint
was on that failed!

Christopher Kings-Lynne
This commit is contained in:
Bruce Momjian 2002-08-04 05:11:37 +00:00
parent 6b64704e4f
commit 10f1f709ab

View File

@ -409,7 +409,7 @@ create table atacc1 ( test int );
alter table atacc1 add constraint atacc_test1 check (test>3);
-- should fail
insert into atacc1 (test) values (2);
ERROR: ExecInsert: rejected due to CHECK constraint atacc_test1
ERROR: ExecInsert: rejected due to CHECK constraint "atacc_test1" on "atacc1"
-- should succeed
insert into atacc1 (test) values (4);
drop table atacc1;
@ -434,7 +434,7 @@ create table atacc1 ( test int, test2 int, test3 int);
alter table atacc1 add constraint atacc_test1 check (test+test2<test3*4);
-- should fail
insert into atacc1 (test,test2,test3) values (4,4,2);
ERROR: ExecInsert: rejected due to CHECK constraint atacc_test1
ERROR: ExecInsert: rejected due to CHECK constraint "atacc_test1" on "atacc1"
-- should succeed
insert into atacc1 (test,test2,test3) values (4,4,5);
drop table atacc1;
@ -443,7 +443,7 @@ create table atacc1 (test int check (test>3), test2 int);
alter table atacc1 add check (test2>test);
-- should fail for $2
insert into atacc1 (test2, test) values (3, 4);
ERROR: ExecInsert: rejected due to CHECK constraint $1
ERROR: ExecInsert: rejected due to CHECK constraint "$1" on "atacc1"
drop table atacc1;
-- inheritance related tests
create table atacc1 (test int);
@ -452,11 +452,11 @@ create table atacc3 (test3 int) inherits (atacc1, atacc2);
alter table atacc2 add constraint foo check (test2>0);
-- fail and then succeed on atacc2
insert into atacc2 (test2) values (-3);
ERROR: ExecInsert: rejected due to CHECK constraint foo
ERROR: ExecInsert: rejected due to CHECK constraint "foo" on "atacc2"
insert into atacc2 (test2) values (3);
-- fail and then succeed on atacc3
insert into atacc3 (test2) values (-3);
ERROR: ExecInsert: rejected due to CHECK constraint foo
ERROR: ExecInsert: rejected due to CHECK constraint "foo" on "atacc3"
insert into atacc3 (test2) values (3);
drop table atacc3;
drop table atacc2;
@ -468,7 +468,7 @@ create table atacc3 (test3 int) inherits (atacc1, atacc2);
alter table only atacc2 add constraint foo check (test2>0);
-- fail and then succeed on atacc2
insert into atacc2 (test2) values (-3);
ERROR: ExecInsert: rejected due to CHECK constraint foo
ERROR: ExecInsert: rejected due to CHECK constraint "foo" on "atacc2"
insert into atacc2 (test2) values (3);
-- both succeed on atacc3
insert into atacc3 (test2) values (-3);