Skip to content
Snippets Groups Projects
Commit b6c881ce authored by Bruce Momjian's avatar Bruce Momjian
Browse files

Update regression tests for new referential integrity error message

wording ("table" added).
parent c104cd20
No related branches found
No related tags found
No related merge requests found
...@@ -307,7 +307,7 @@ SELECT * FROM PKTABLE; ...@@ -307,7 +307,7 @@ SELECT * FROM PKTABLE;
-- Delete a row from PK TABLE (should fail) -- Delete a row from PK TABLE (should fail)
DELETE FROM PKTABLE WHERE ptest1=1; DELETE FROM PKTABLE WHERE ptest1=1;
ERROR: update or delete on "pktable" violates foreign key constraint "fktable_ftest1_fkey" on "fktable" ERROR: update or delete on table "pktable" violates foreign key constraint "fktable_ftest1_fkey" on table "fktable"
DETAIL: Key (ptest1)=(1) is still referenced from table "fktable". DETAIL: Key (ptest1)=(1) is still referenced from table "fktable".
-- Delete a row from PK TABLE (should succeed) -- Delete a row from PK TABLE (should succeed)
DELETE FROM PKTABLE WHERE ptest1=5; DELETE FROM PKTABLE WHERE ptest1=5;
...@@ -323,7 +323,7 @@ SELECT * FROM PKTABLE; ...@@ -323,7 +323,7 @@ SELECT * FROM PKTABLE;
-- Update a row from PK TABLE (should fail) -- Update a row from PK TABLE (should fail)
UPDATE PKTABLE SET ptest1=0 WHERE ptest1=2; UPDATE PKTABLE SET ptest1=0 WHERE ptest1=2;
ERROR: update or delete on "pktable" violates foreign key constraint "fktable_ftest1_fkey" on "fktable" ERROR: update or delete on table "pktable" violates foreign key constraint "fktable_ftest1_fkey" on table "fktable"
DETAIL: Key (ptest1)=(2) is still referenced from table "fktable". DETAIL: Key (ptest1)=(2) is still referenced from table "fktable".
-- Update a row from PK TABLE (should succeed) -- Update a row from PK TABLE (should succeed)
UPDATE PKTABLE SET ptest1=0 WHERE ptest1=4; UPDATE PKTABLE SET ptest1=0 WHERE ptest1=4;
...@@ -373,13 +373,13 @@ SELECT * from FKTABLE; ...@@ -373,13 +373,13 @@ SELECT * from FKTABLE;
-- Try to update something that should fail -- Try to update something that should fail
UPDATE PKTABLE set ptest2=5 where ptest2=2; UPDATE PKTABLE set ptest2=5 where ptest2=2;
ERROR: update or delete on "pktable" violates foreign key constraint "constrname3" on "fktable" ERROR: update or delete on table "pktable" violates foreign key constraint "constrname3" on table "fktable"
DETAIL: Key (ptest1,ptest2,ptest3)=(1,2,3) is still referenced from table "fktable". DETAIL: Key (ptest1,ptest2,ptest3)=(1,2,3) is still referenced from table "fktable".
-- Try to update something that should succeed -- Try to update something that should succeed
UPDATE PKTABLE set ptest1=1 WHERE ptest2=3; UPDATE PKTABLE set ptest1=1 WHERE ptest2=3;
-- Try to delete something that should fail -- Try to delete something that should fail
DELETE FROM PKTABLE where ptest1=1 and ptest2=2 and ptest3=3; DELETE FROM PKTABLE where ptest1=1 and ptest2=2 and ptest3=3;
ERROR: update or delete on "pktable" violates foreign key constraint "constrname3" on "fktable" ERROR: update or delete on table "pktable" violates foreign key constraint "constrname3" on table "fktable"
DETAIL: Key (ptest1,ptest2,ptest3)=(1,2,3) is still referenced from table "fktable". DETAIL: Key (ptest1,ptest2,ptest3)=(1,2,3) is still referenced from table "fktable".
-- Try to delete something that should work -- Try to delete something that should work
DELETE FROM PKTABLE where ptest1=2; DELETE FROM PKTABLE where ptest1=2;
...@@ -849,12 +849,12 @@ insert into pktable(base1) values (3); ...@@ -849,12 +849,12 @@ insert into pktable(base1) values (3);
insert into fktable(ftest1) values (3); insert into fktable(ftest1) values (3);
-- let's try removing a row that should fail from pktable -- let's try removing a row that should fail from pktable
delete from pktable where base1>2; delete from pktable where base1>2;
ERROR: update or delete on "pktable" violates foreign key constraint "fktable_ftest1_fkey" on "fktable" ERROR: update or delete on table "pktable" violates foreign key constraint "fktable_ftest1_fkey" on table "fktable"
DETAIL: Key (base1)=(3) is still referenced from table "fktable". DETAIL: Key (base1)=(3) is still referenced from table "fktable".
-- okay, let's try updating all of the base1 values to *4 -- okay, let's try updating all of the base1 values to *4
-- which should fail. -- which should fail.
update pktable set base1=base1*4; update pktable set base1=base1*4;
ERROR: update or delete on "pktable" violates foreign key constraint "fktable_ftest1_fkey" on "fktable" ERROR: update or delete on table "pktable" violates foreign key constraint "fktable_ftest1_fkey" on table "fktable"
DETAIL: Key (base1)=(3) is still referenced from table "fktable". DETAIL: Key (base1)=(3) is still referenced from table "fktable".
-- okay, let's try an update that should work. -- okay, let's try an update that should work.
update pktable set base1=base1*4 where base1<3; update pktable set base1=base1*4 where base1<3;
...@@ -877,12 +877,12 @@ insert into pktable(base1,ptest1) values (3, 1); ...@@ -877,12 +877,12 @@ insert into pktable(base1,ptest1) values (3, 1);
insert into fktable(ftest1, ftest2) values (3, 1); insert into fktable(ftest1, ftest2) values (3, 1);
-- let's try removing a row that should fail from pktable -- let's try removing a row that should fail from pktable
delete from pktable where base1>2; delete from pktable where base1>2;
ERROR: update or delete on "pktable" violates foreign key constraint "fktable_ftest1_fkey" on "fktable" ERROR: update or delete on table "pktable" violates foreign key constraint "fktable_ftest1_fkey" on table "fktable"
DETAIL: Key (base1,ptest1)=(3,1) is still referenced from table "fktable". DETAIL: Key (base1,ptest1)=(3,1) is still referenced from table "fktable".
-- okay, let's try updating all of the base1 values to *4 -- okay, let's try updating all of the base1 values to *4
-- which should fail. -- which should fail.
update pktable set base1=base1*4; update pktable set base1=base1*4;
ERROR: update or delete on "pktable" violates foreign key constraint "fktable_ftest1_fkey" on "fktable" ERROR: update or delete on table "pktable" violates foreign key constraint "fktable_ftest1_fkey" on table "fktable"
DETAIL: Key (base1,ptest1)=(3,1) is still referenced from table "fktable". DETAIL: Key (base1,ptest1)=(3,1) is still referenced from table "fktable".
-- okay, let's try an update that should work. -- okay, let's try an update that should work.
update pktable set base1=base1*4 where base1<3; update pktable set base1=base1*4 where base1<3;
...@@ -907,11 +907,11 @@ ERROR: insert or update on table "pktable" violates foreign key constraint "pkt ...@@ -907,11 +907,11 @@ ERROR: insert or update on table "pktable" violates foreign key constraint "pkt
DETAIL: Key (base2,ptest2)=(3,2) is not present in table "pktable". DETAIL: Key (base2,ptest2)=(3,2) is not present in table "pktable".
-- fails (2,2) is being referenced -- fails (2,2) is being referenced
delete from pktable where base1=2; delete from pktable where base1=2;
ERROR: update or delete on "pktable" violates foreign key constraint "pktable_base2_fkey" on "pktable" ERROR: update or delete on table "pktable" violates foreign key constraint "pktable_base2_fkey" on table "pktable"
DETAIL: Key (base1,ptest1)=(2,2) is still referenced from table "pktable". DETAIL: Key (base1,ptest1)=(2,2) is still referenced from table "pktable".
-- fails (1,1) is being referenced (twice) -- fails (1,1) is being referenced (twice)
update pktable set base1=3 where base1=1; update pktable set base1=3 where base1=1;
ERROR: update or delete on "pktable" violates foreign key constraint "pktable_base2_fkey" on "pktable" ERROR: update or delete on table "pktable" violates foreign key constraint "pktable_base2_fkey" on table "pktable"
DETAIL: Key (base1,ptest1)=(1,1) is still referenced from table "pktable". DETAIL: Key (base1,ptest1)=(1,1) is still referenced from table "pktable".
-- this sequence of two deletes will work, since after the first there will be no (2,*) references -- this sequence of two deletes will work, since after the first there will be no (2,*) references
delete from pktable where base2=2; delete from pktable where base2=2;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment