diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2004-06-10 17:56:03 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2004-06-10 17:56:03 +0000 |
| commit | 45616f5bbbb87745e0e82b00e77562d6502aa042 (patch) | |
| tree | 18d24d180f5c0c954268e64f5b6fe62922fc106e /src/test | |
| parent | 75db5a665fac305ac0170f49f39c1b01d026e8d3 (diff) | |
| download | postgresql-45616f5bbbb87745e0e82b00e77562d6502aa042.tar.gz | |
Clean up generation of default names for constraints, indexes, and serial
sequences, as per recent discussion. All these names are now of the
form table_column_type, with digits added if needed to make them unique.
Default constraint names are chosen to be unique across their whole schema,
not just within the parent object, so as to be more SQL-spec-compatible
and make the information schema views more useful.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/regress/expected/alter_table.out | 28 | ||||
| -rw-r--r-- | src/test/regress/expected/cluster.out | 12 | ||||
| -rw-r--r-- | src/test/regress/expected/copy2.out | 4 | ||||
| -rw-r--r-- | src/test/regress/expected/domain.out | 8 | ||||
| -rw-r--r-- | src/test/regress/expected/foreign_key.out | 76 | ||||
| -rw-r--r-- | src/test/regress/expected/namespace.out | 2 | ||||
| -rw-r--r-- | src/test/regress/expected/rules.out | 8 | ||||
| -rw-r--r-- | src/test/regress/expected/sequence.out | 2 | ||||
| -rw-r--r-- | src/test/regress/expected/truncate.out | 2 | ||||
| -rw-r--r-- | src/test/regress/output/constraints.source | 8 | ||||
| -rw-r--r-- | src/test/regress/sql/copy2.sql | 2 |
11 files changed, 76 insertions, 76 deletions
diff --git a/src/test/regress/expected/alter_table.out b/src/test/regress/expected/alter_table.out index feb0852032..a8f81624fb 100644 --- a/src/test/regress/expected/alter_table.out +++ b/src/test/regress/expected/alter_table.out @@ -194,27 +194,27 @@ NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" fo CREATE TEMP TABLE FKTABLE (ftest1 inet); -- This next should fail, because inet=int does not exist ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1) references pktable; -ERROR: foreign key constraint "$1" cannot be implemented +ERROR: foreign key constraint "fktable_ftest1_fkey" cannot be implemented DETAIL: Key columns "ftest1" and "ptest1" are of incompatible types: inet and integer. -- This should also fail for the same reason, but here we -- give the column name ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1) references pktable(ptest1); -ERROR: foreign key constraint "$1" cannot be implemented +ERROR: foreign key constraint "fktable_ftest1_fkey" cannot be implemented DETAIL: Key columns "ftest1" and "ptest1" are of incompatible types: inet and integer. -- This should succeed, even though they are different types -- because varchar=int does exist DROP TABLE FKTABLE; CREATE TEMP TABLE FKTABLE (ftest1 varchar); ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1) references pktable; -WARNING: foreign key constraint "$1" will require costly sequential scans +WARNING: foreign key constraint "fktable_ftest1_fkey" will require costly sequential scans DETAIL: Key columns "ftest1" and "ptest1" are of different types: character varying and integer. -- As should this ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1) references pktable(ptest1); -WARNING: foreign key constraint "$2" will require costly sequential scans +WARNING: foreign key constraint "fktable_ftest1_fkey1" will require costly sequential scans DETAIL: Key columns "ftest1" and "ptest1" are of different types: character varying and integer. DROP TABLE pktable cascade; -NOTICE: drop cascades to constraint $2 on table fktable -NOTICE: drop cascades to constraint $1 on table fktable +NOTICE: drop cascades to constraint fktable_ftest1_fkey1 on table fktable +NOTICE: drop cascades to constraint fktable_ftest1_fkey on table fktable DROP TABLE fktable; CREATE TEMP TABLE PKTABLE (ptest1 int, ptest2 inet, PRIMARY KEY(ptest1, ptest2)); @@ -222,26 +222,26 @@ NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" fo -- This should fail, because we just chose really odd types CREATE TEMP TABLE FKTABLE (ftest1 cidr, ftest2 timestamp); ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1, ftest2) references pktable; -ERROR: foreign key constraint "$1" cannot be implemented +ERROR: foreign key constraint "fktable_ftest1_fkey" cannot be implemented DETAIL: Key columns "ftest1" and "ptest1" are of incompatible types: cidr and integer. DROP TABLE FKTABLE; -- Again, so should this... CREATE TEMP TABLE FKTABLE (ftest1 cidr, ftest2 timestamp); ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1, ftest2) references pktable(ptest1, ptest2); -ERROR: foreign key constraint "$1" cannot be implemented +ERROR: foreign key constraint "fktable_ftest1_fkey" cannot be implemented DETAIL: Key columns "ftest1" and "ptest1" are of incompatible types: cidr and integer. DROP TABLE FKTABLE; -- This fails because we mixed up the column ordering CREATE TEMP TABLE FKTABLE (ftest1 int, ftest2 inet); ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1, ftest2) references pktable(ptest2, ptest1); -ERROR: foreign key constraint "$1" cannot be implemented +ERROR: foreign key constraint "fktable_ftest1_fkey" cannot be implemented DETAIL: Key columns "ftest1" and "ptest2" are of incompatible types: integer and inet. -- As does this... ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest2, ftest1) references pktable(ptest1, ptest2); -ERROR: foreign key constraint "$1" cannot be implemented +ERROR: foreign key constraint "fktable_ftest2_fkey" cannot be implemented DETAIL: Key columns "ftest2" and "ptest1" are of incompatible types: inet and integer. -- temp tables should go away by themselves, need not drop them. -- test check constraint adding @@ -284,7 +284,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: new row for relation "atacc1" violates check constraint "$1" +ERROR: new row for relation "atacc1" violates check constraint "atacc1_check" drop table atacc1; -- inheritance related tests create table atacc1 (test int); @@ -1081,7 +1081,7 @@ alter table p1 add column f2 text; NOTICE: merging definition of column "f2" for child "c1" insert into p1 values (1,2,'abc'); insert into c1 values(11,'xyz',33,0); -- should fail -ERROR: new row for relation "c1" violates check constraint "p1_a1" +ERROR: new row for relation "c1" violates check constraint "c1_a1_check" insert into c1 values(11,'xyz',33,22); select * from p1; f1 | a1 | f2 @@ -1100,7 +1100,7 @@ select * from p1; drop table p1 cascade; NOTICE: drop cascades to table c1 -NOTICE: drop cascades to constraint p1_a1 on table c1 +NOTICE: drop cascades to constraint c1_a1_check on table c1 -- test that operations with a dropped column do not try to reference -- its datatype create domain mytype as text; @@ -1148,7 +1148,7 @@ ERROR: column "f1" cannot be cast to type "pg_catalog.int4" alter table foo alter f1 TYPE varchar(10); create table anothertab (atcol1 serial8, atcol2 boolean, constraint anothertab_chk check (atcol1 <= 3)); -NOTICE: CREATE TABLE will create implicit sequence "anothertab_atcol1_seq" for "serial" column "anothertab.atcol1" +NOTICE: CREATE TABLE will create implicit sequence "anothertab_atcol1_seq" for serial column "anothertab.atcol1" insert into anothertab (atcol1, atcol2) values (default, true); insert into anothertab (atcol1, atcol2) values (default, false); select * from anothertab; diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e5f2e4cda6..7fa83a5723 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -3,14 +3,14 @@ -- CREATE TABLE clstr_tst_s (rf_a SERIAL PRIMARY KEY, b INT); -NOTICE: CREATE TABLE will create implicit sequence "clstr_tst_s_rf_a_seq" for "serial" column "clstr_tst_s.rf_a" +NOTICE: CREATE TABLE will create implicit sequence "clstr_tst_s_rf_a_seq" for serial column "clstr_tst_s.rf_a" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "clstr_tst_s_pkey" for table "clstr_tst_s" CREATE TABLE clstr_tst (a SERIAL PRIMARY KEY, b INT, c TEXT, d TEXT, CONSTRAINT clstr_tst_con FOREIGN KEY (b) REFERENCES clstr_tst_s); -NOTICE: CREATE TABLE will create implicit sequence "clstr_tst_a_seq" for "serial" column "clstr_tst.a" +NOTICE: CREATE TABLE will create implicit sequence "clstr_tst_a_seq" for serial column "clstr_tst.a" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "clstr_tst_pkey" for table "clstr_tst" CREATE INDEX clstr_tst_b ON clstr_tst (b); CREATE INDEX clstr_tst_c ON clstr_tst (c); @@ -303,10 +303,10 @@ SELECT pg_class.relname FROM pg_index, pg_class, pg_class AS pg_class_2 WHERE pg_class.oid=indexrelid AND indrelid=pg_class_2.oid AND pg_class_2.relname = 'clstr_tst' - AND indisclustered; - relname - --------- - (0 rows) + AND indisclustered; + relname +--------- +(0 rows) -- Verify that clustering all tables does in fact cluster the right ones CREATE USER clstr_user; diff --git a/src/test/regress/expected/copy2.out b/src/test/regress/expected/copy2.out index 6048f9392f..f3da7e85c6 100644 --- a/src/test/regress/expected/copy2.out +++ b/src/test/regress/expected/copy2.out @@ -5,7 +5,7 @@ CREATE TABLE x ( d text, e text ); -NOTICE: CREATE TABLE will create implicit sequence "x_a_seq" for "serial" column "x.a" +NOTICE: CREATE TABLE will create implicit sequence "x_a_seq" for serial column "x.a" CREATE FUNCTION fn_x_before () RETURNS TRIGGER AS ' BEGIN NEW.e := ''before trigger fired''::text; @@ -191,6 +191,6 @@ COPY y TO stdout WITH CSV FORCE QUOTE col2 ESCAPE '\\'; "Jackson, Sam","\\h" "It is \"perfect\"."," " "", -DROP TABLE x; +DROP TABLE x, y; DROP FUNCTION fn_x_before(); DROP FUNCTION fn_x_after(); diff --git a/src/test/regress/expected/domain.out b/src/test/regress/expected/domain.out index b23e84e728..39929de2b3 100644 --- a/src/test/regress/expected/domain.out +++ b/src/test/regress/expected/domain.out @@ -116,7 +116,7 @@ INSERT INTO nulltest values ('a', 'b', 'c', 'd', 'c'); -- Good insert into nulltest values ('a', 'b', 'c', 'd', NULL); ERROR: domain dcheck does not allow null values insert into nulltest values ('a', 'b', 'c', 'd', 'a'); -ERROR: new row for relation "nulltest" violates check constraint "nulltest_col5" +ERROR: new row for relation "nulltest" violates check constraint "nulltest_col5_check" INSERT INTO nulltest values (NULL, 'b', 'c', 'd', 'd'); ERROR: domain dnotnull does not allow null values INSERT INTO nulltest values ('a', NULL, 'c', 'd', 'c'); @@ -130,7 +130,7 @@ ERROR: domain dcheck does not allow null values CONTEXT: COPY nulltest, line 1: "a b \N d \N" -- Last row is bad COPY nulltest FROM stdin; -ERROR: new row for relation "nulltest" violates check constraint "nulltest_col5" +ERROR: new row for relation "nulltest" violates check constraint "nulltest_col5_check" CONTEXT: COPY nulltest, line 3: "a b c \N a" select * from nulltest; col1 | col2 | col3 | col4 | col5 @@ -251,13 +251,13 @@ ERROR: column "col1" of table "domcontest" contains values that violate the new alter domain con add constraint t check (VALUE < 34); alter domain con add check (VALUE > 0); insert into domcontest values (-5); -- fails -ERROR: value for domain con violates check constraint "$1" +ERROR: value for domain con violates check constraint "con_check" insert into domcontest values (42); -- fails ERROR: value for domain con violates check constraint "t" insert into domcontest values (5); alter domain con drop constraint t; insert into domcontest values (-5); --fails -ERROR: value for domain con violates check constraint "$1" +ERROR: value for domain con violates check constraint "con_check" insert into domcontest values (42); -- Confirm ALTER DOMAIN with RULES. create table domtab (col1 integer); diff --git a/src/test/regress/expected/foreign_key.out b/src/test/regress/expected/foreign_key.out index 5aae3720d3..3c9a7d6668 100644 --- a/src/test/regress/expected/foreign_key.out +++ b/src/test/regress/expected/foreign_key.out @@ -21,7 +21,7 @@ INSERT INTO FKTABLE VALUES (3, 4); INSERT INTO FKTABLE VALUES (NULL, 1); -- Insert a failed row into FK TABLE INSERT INTO FKTABLE VALUES (100, 2); -ERROR: insert or update on table "fktable" violates foreign key constraint "$1" +ERROR: insert or update on table "fktable" violates foreign key constraint "fktable_ftest1_fkey" DETAIL: Key (ftest1)=(100) is not present in table "pktable". -- Check FKTABLE SELECT * FROM FKTABLE; @@ -282,7 +282,7 @@ INSERT INTO FKTABLE VALUES (3, 4); INSERT INTO FKTABLE VALUES (NULL, 1); -- Insert a failed row into FK TABLE INSERT INTO FKTABLE VALUES (100, 2); -ERROR: insert or update on table "fktable" violates foreign key constraint "$1" +ERROR: insert or update on table "fktable" violates foreign key constraint "fktable_ftest1_fkey" DETAIL: Key (ftest1)=(100) is not present in table "pktable". -- Check FKTABLE SELECT * FROM FKTABLE; @@ -307,7 +307,7 @@ SELECT * FROM PKTABLE; -- Delete a row from PK TABLE (should fail) DELETE FROM PKTABLE WHERE ptest1=1; -ERROR: update or delete on "pktable" violates foreign key constraint "$1" on "fktable" +ERROR: update or delete on "pktable" violates foreign key constraint "fktable_ftest1_fkey" on "fktable" DETAIL: Key (ptest1)=(1) is still referenced from table "fktable". -- Delete a row from PK TABLE (should succeed) DELETE FROM PKTABLE WHERE ptest1=5; @@ -323,7 +323,7 @@ SELECT * FROM PKTABLE; -- Update a row from PK TABLE (should fail) UPDATE PKTABLE SET ptest1=0 WHERE ptest1=2; -ERROR: update or delete on "pktable" violates foreign key constraint "$1" on "fktable" +ERROR: update or delete on "pktable" violates foreign key constraint "fktable_ftest1_fkey" on "fktable" DETAIL: Key (ptest1)=(2) is still referenced from table "fktable". -- Update a row from PK TABLE (should succeed) UPDATE PKTABLE SET ptest1=0 WHERE ptest1=4; @@ -750,22 +750,22 @@ CREATE TABLE PKTABLE (ptest1 int PRIMARY KEY); NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" for table "pktable" -- This next should fail, because inet=int does not exist CREATE TABLE FKTABLE (ftest1 inet REFERENCES pktable); -ERROR: foreign key constraint "$1" cannot be implemented +ERROR: foreign key constraint "fktable_ftest1_fkey" cannot be implemented DETAIL: Key columns "ftest1" and "ptest1" are of incompatible types: inet and integer. -- This should also fail for the same reason, but here we -- give the column name CREATE TABLE FKTABLE (ftest1 inet REFERENCES pktable(ptest1)); -ERROR: foreign key constraint "$1" cannot be implemented +ERROR: foreign key constraint "fktable_ftest1_fkey" cannot be implemented DETAIL: Key columns "ftest1" and "ptest1" are of incompatible types: inet and integer. -- This should succeed (with a warning), even though they are different types -- because int=varchar does exist CREATE TABLE FKTABLE (ftest1 varchar REFERENCES pktable); -WARNING: foreign key constraint "$1" will require costly sequential scans +WARNING: foreign key constraint "fktable_ftest1_fkey" will require costly sequential scans DETAIL: Key columns "ftest1" and "ptest1" are of different types: character varying and integer. DROP TABLE FKTABLE; -- As should this CREATE TABLE FKTABLE (ftest1 varchar REFERENCES pktable(ptest1)); -WARNING: foreign key constraint "$1" will require costly sequential scans +WARNING: foreign key constraint "fktable_ftest1_fkey" will require costly sequential scans DETAIL: Key columns "ftest1" and "ptest1" are of different types: character varying and integer. DROP TABLE FKTABLE; DROP TABLE PKTABLE; @@ -774,23 +774,23 @@ CREATE TABLE PKTABLE (ptest1 int, ptest2 inet, PRIMARY KEY(ptest1, ptest2)); NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" for table "pktable" -- This should fail, because we just chose really odd types CREATE TABLE FKTABLE (ftest1 cidr, ftest2 timestamp, FOREIGN KEY(ftest1, ftest2) REFERENCES pktable); -ERROR: foreign key constraint "$1" cannot be implemented +ERROR: foreign key constraint "fktable_ftest1_fkey" cannot be implemented DETAIL: Key columns "ftest1" and "ptest1" are of incompatible types: cidr and integer. -- Again, so should this... CREATE TABLE FKTABLE (ftest1 cidr, ftest2 timestamp, FOREIGN KEY(ftest1, ftest2) REFERENCES pktable(ptest1, ptest2)); -ERROR: foreign key constraint "$1" cannot be implemented +ERROR: foreign key constraint "fktable_ftest1_fkey" cannot be implemented DETAIL: Key columns "ftest1" and "ptest1" are of incompatible types: cidr and integer. -- This fails because we mixed up the column ordering CREATE TABLE FKTABLE (ftest1 int, ftest2 inet, FOREIGN KEY(ftest2, ftest1) REFERENCES pktable); -ERROR: foreign key constraint "$1" cannot be implemented +ERROR: foreign key constraint "fktable_ftest2_fkey" cannot be implemented DETAIL: Key columns "ftest2" and "ptest1" are of incompatible types: inet and integer. -- As does this... CREATE TABLE FKTABLE (ftest1 int, ftest2 inet, FOREIGN KEY(ftest2, ftest1) REFERENCES pktable(ptest1, ptest2)); -ERROR: foreign key constraint "$1" cannot be implemented +ERROR: foreign key constraint "fktable_ftest2_fkey" cannot be implemented DETAIL: Key columns "ftest2" and "ptest1" are of incompatible types: inet and integer. -- And again.. CREATE TABLE FKTABLE (ftest1 int, ftest2 inet, FOREIGN KEY(ftest1, ftest2) REFERENCES pktable(ptest2, ptest1)); -ERROR: foreign key constraint "$1" cannot be implemented +ERROR: foreign key constraint "fktable_ftest1_fkey" cannot be implemented DETAIL: Key columns "ftest1" and "ptest2" are of incompatible types: integer and inet. -- This works... CREATE TABLE FKTABLE (ftest1 int, ftest2 inet, FOREIGN KEY(ftest2, ftest1) REFERENCES pktable(ptest2, ptest1)); @@ -814,19 +814,19 @@ DROP TABLE PKTABLE; CREATE TABLE PKTABLE (ptest1 int, ptest2 inet, ptest3 int, ptest4 inet, PRIMARY KEY(ptest1, ptest2), FOREIGN KEY(ptest3, ptest4) REFERENCES pktable(ptest2, ptest1)); NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" for table "pktable" -ERROR: foreign key constraint "$1" cannot be implemented +ERROR: foreign key constraint "pktable_ptest3_fkey" cannot be implemented DETAIL: Key columns "ptest3" and "ptest2" are of incompatible types: integer and inet. -- Nor should this... (same reason, we have 4,3 referencing 1,2 which mismatches types CREATE TABLE PKTABLE (ptest1 int, ptest2 inet, ptest3 int, ptest4 inet, PRIMARY KEY(ptest1, ptest2), FOREIGN KEY(ptest4, ptest3) REFERENCES pktable(ptest1, ptest2)); NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" for table "pktable" -ERROR: foreign key constraint "$1" cannot be implemented +ERROR: foreign key constraint "pktable_ptest4_fkey" cannot be implemented DETAIL: Key columns "ptest4" and "ptest1" are of incompatible types: inet and integer. -- Not this one either... Same as the last one except we didn't defined the columns being referenced. CREATE TABLE PKTABLE (ptest1 int, ptest2 inet, ptest3 int, ptest4 inet, PRIMARY KEY(ptest1, ptest2), FOREIGN KEY(ptest4, ptest3) REFERENCES pktable); NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" for table "pktable" -ERROR: foreign key constraint "$1" cannot be implemented +ERROR: foreign key constraint "pktable_ptest4_fkey" cannot be implemented DETAIL: Key columns "ptest4" and "ptest1" are of incompatible types: inet and integer. -- -- Now some cases with inheritance @@ -841,19 +841,19 @@ insert into pktable(base1) values (1); insert into pktable(base1) values (2); -- let's insert a non-existant fktable value insert into fktable(ftest1) values (3); -ERROR: insert or update on table "fktable" violates foreign key constraint "$1" +ERROR: insert or update on table "fktable" violates foreign key constraint "fktable_ftest1_fkey" DETAIL: Key (ftest1)=(3) is not present in table "pktable". -- let's make a valid row for that insert into pktable(base1) values (3); insert into fktable(ftest1) values (3); -- let's try removing a row that should fail from pktable delete from pktable where base1>2; -ERROR: update or delete on "pktable" violates foreign key constraint "$1" on "fktable" +ERROR: update or delete on "pktable" violates foreign key constraint "fktable_ftest1_fkey" on "fktable" DETAIL: Key (base1)=(3) is still referenced from table "fktable". -- okay, let's try updating all of the base1 values to *4 -- which should fail. update pktable set base1=base1*4; -ERROR: update or delete on "pktable" violates foreign key constraint "$1" on "fktable" +ERROR: update or delete on "pktable" violates foreign key constraint "fktable_ftest1_fkey" on "fktable" DETAIL: Key (base1)=(3) is still referenced from table "fktable". -- okay, let's try an update that should work. update pktable set base1=base1*4 where base1<3; @@ -869,19 +869,19 @@ insert into pktable(base1, ptest1) values (1, 1); insert into pktable(base1, ptest1) values (2, 2); -- let's insert a non-existant fktable value insert into fktable(ftest1, ftest2) values (3, 1); -ERROR: insert or update on table "fktable" violates foreign key constraint "$1" +ERROR: insert or update on table "fktable" violates foreign key constraint "fktable_ftest1_fkey" DETAIL: Key (ftest1,ftest2)=(3,1) is not present in table "pktable". -- let's make a valid row for that insert into pktable(base1,ptest1) values (3, 1); insert into fktable(ftest1, ftest2) values (3, 1); -- let's try removing a row that should fail from pktable delete from pktable where base1>2; -ERROR: update or delete on "pktable" violates foreign key constraint "$1" on "fktable" +ERROR: update or delete on "pktable" violates foreign key constraint "fktable_ftest1_fkey" on "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 -- which should fail. update pktable set base1=base1*4; -ERROR: update or delete on "pktable" violates foreign key constraint "$1" on "fktable" +ERROR: update or delete on "pktable" violates foreign key constraint "fktable_ftest1_fkey" on "fktable" DETAIL: Key (base1,ptest1)=(3,1) is still referenced from table "fktable". -- okay, let's try an update that should work. update pktable set base1=base1*4 where base1<3; @@ -902,15 +902,15 @@ insert into pktable (base1, ptest1, base2, ptest2) values (2, 2, 2, 1); insert into pktable (base1, ptest1, base2, ptest2) values (1, 3, 2, 2); -- fails (3,2) isn't in base1, ptest1 insert into pktable (base1, ptest1, base2, ptest2) values (2, 3, 3, 2); -ERROR: insert or update on table "pktable" violates foreign key constraint "$1" +ERROR: insert or update on table "pktable" violates foreign key constraint "pktable_base2_fkey" DETAIL: Key (base2,ptest2)=(3,2) is not present in table "pktable". -- fails (2,2) is being referenced delete from pktable where base1=2; -ERROR: update or delete on "pktable" violates foreign key constraint "$1" on "pktable" +ERROR: update or delete on "pktable" violates foreign key constraint "pktable_base2_fkey" on "pktable" DETAIL: Key (base1,ptest1)=(2,2) is still referenced from table "pktable". -- fails (1,1) is being referenced (twice) update pktable set base1=3 where base1=1; -ERROR: update or delete on "pktable" violates foreign key constraint "$1" on "pktable" +ERROR: update or delete on "pktable" violates foreign key constraint "pktable_base2_fkey" on "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 delete from pktable where base2=2; @@ -923,20 +923,20 @@ create table pktable(ptest1 inet, primary key(base1, ptest1)) inherits (pktable_ NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" for table "pktable" -- just generally bad types (with and without column references on the referenced table) create table fktable(ftest1 cidr, ftest2 int[], foreign key (ftest1, ftest2) references pktable); -ERROR: foreign key constraint "$1" cannot be implemented +ERROR: foreign key constraint "fktable_ftest1_fkey" cannot be implemented DETAIL: Key columns "ftest1" and "base1" are of incompatible types: cidr and integer. create table fktable(ftest1 cidr, ftest2 int[], foreign key (ftest1, ftest2) references pktable(base1, ptest1)); -ERROR: foreign key constraint "$1" cannot be implemented +ERROR: foreign key constraint "fktable_ftest1_fkey" cannot be implemented DETAIL: Key columns "ftest1" and "base1" are of incompatible types: cidr and integer. -- let's mix up which columns reference which create table fktable(ftest1 int, ftest2 inet, foreign key(ftest2, ftest1) references pktable); -ERROR: foreign key constraint "$1" cannot be implemented +ERROR: foreign key constraint "fktable_ftest2_fkey" cannot be implemented DETAIL: Key columns "ftest2" and "base1" are of incompatible types: inet and integer. create table fktable(ftest1 int, ftest2 inet, foreign key(ftest2, ftest1) references pktable(base1, ptest1)); -ERROR: foreign key constraint "$1" cannot be implemented +ERROR: foreign key constraint "fktable_ftest2_fkey" cannot be implemented DETAIL: Key columns "ftest2" and "base1" are of incompatible types: inet and integer. create table fktable(ftest1 int, ftest2 inet, foreign key(ftest1, ftest2) references pktable(ptest1, base1)); -ERROR: foreign key constraint "$1" cannot be implemented +ERROR: foreign key constraint "fktable_ftest1_fkey" cannot be implemented DETAIL: Key columns "ftest1" and "ptest1" are of incompatible types: integer and inet. drop table pktable; drop table pktable_base; @@ -945,22 +945,22 @@ create table pktable_base(base1 int not null, base2 int); create table pktable(ptest1 inet, ptest2 inet[], primary key(base1, ptest1), foreign key(base2, ptest2) references pktable(base1, ptest1)) inherits (pktable_base); NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" for table "pktable" -ERROR: foreign key constraint "$1" cannot be implemented +ERROR: foreign key constraint "pktable_base2_fkey" cannot be implemented DETAIL: Key columns "ptest2" and "ptest1" are of incompatible types: inet[] and inet. create table pktable(ptest1 inet, ptest2 inet, primary key(base1, ptest1), foreign key(base2, ptest2) references pktable(ptest1, base1)) inherits (pktable_base); NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" for table "pktable" -ERROR: foreign key constraint "$1" cannot be implemented +ERROR: foreign key constraint "pktable_base2_fkey" cannot be implemented DETAIL: Key columns "base2" and "ptest1" are of incompatible types: integer and inet. create table pktable(ptest1 inet, ptest2 inet, primary key(base1, ptest1), foreign key(ptest2, base2) references pktable(base1, ptest1)) inherits (pktable_base); NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" for table "pktable" -ERROR: foreign key constraint "$1" cannot be implemented +ERROR: foreign key constraint "pktable_ptest2_fkey" cannot be implemented DETAIL: Key columns "ptest2" and "base1" are of incompatible types: inet and integer. create table pktable(ptest1 inet, ptest2 inet, primary key(base1, ptest1), foreign key(ptest2, base2) references pktable(base1, ptest1)) inherits (pktable_base); NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" for table "pktable" -ERROR: foreign key constraint "$1" cannot be implemented +ERROR: foreign key constraint "pktable_ptest2_fkey" cannot be implemented DETAIL: Key columns "ptest2" and "base1" are of incompatible types: inet and integer. drop table pktable; ERROR: table "pktable" does not exist @@ -982,7 +982,7 @@ CREATE TABLE fktable ( NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "fktable_pkey" for table "fktable" -- default to immediate: should fail INSERT INTO fktable VALUES (5, 10); -ERROR: insert or update on table "fktable" violates foreign key constraint "$1" +ERROR: insert or update on table "fktable" violates foreign key constraint "fktable_fk_fkey" DETAIL: Key (fk)=(10) is not present in table "pktable". -- explicitely defer the constraint BEGIN; @@ -1012,7 +1012,7 @@ BEGIN; SET CONSTRAINTS ALL IMMEDIATE; -- should fail INSERT INTO fktable VALUES (500, 1000); -ERROR: insert or update on table "fktable" violates foreign key constraint "$1" +ERROR: insert or update on table "fktable" violates foreign key constraint "fktable_fk_fkey" DETAIL: Key (fk)=(1000) is not present in table "pktable". COMMIT; DROP TABLE fktable, pktable; @@ -1036,7 +1036,7 @@ SET CONSTRAINTS ALL DEFERRED; INSERT INTO fktable VALUES (1000, 2000); -- should cause transaction abort, due to preceding error SET CONSTRAINTS ALL IMMEDIATE; -ERROR: insert or update on table "fktable" violates foreign key constraint "$1" +ERROR: insert or update on table "fktable" violates foreign key constraint "fktable_fk_fkey" DETAIL: Key (fk)=(2000) is not present in table "pktable". INSERT INTO pktable VALUES (2000, 3); -- too late ERROR: current transaction is aborted, commands ignored until end of transaction block @@ -1058,7 +1058,7 @@ BEGIN; INSERT INTO fktable VALUES (100, 200); -- error here on commit COMMIT; -ERROR: insert or update on table "fktable" violates foreign key constraint "$1" +ERROR: insert or update on table "fktable" violates foreign key constraint "fktable_fk_fkey" DETAIL: Key (fk)=(200) is not present in table "pktable". -- test notice about expensive referential integrity checks, -- where the index cannot be used because of type incompatibilities. diff --git a/src/test/regress/expected/namespace.out b/src/test/regress/expected/namespace.out index 60e3a82ea3..646bb63979 100644 --- a/src/test/regress/expected/namespace.out +++ b/src/test/regress/expected/namespace.out @@ -9,7 +9,7 @@ CREATE SCHEMA test_schema_1 a serial, b int UNIQUE ); -NOTICE: CREATE TABLE will create implicit sequence "abc_a_seq" for "serial" column "abc.a" +NOTICE: CREATE TABLE will create implicit sequence "abc_a_seq" for serial column "abc.a" NOTICE: CREATE TABLE / UNIQUE will create implicit index "abc_b_key" for table "abc" -- verify that the objects were created SELECT COUNT(*) FROM pg_class WHERE relnamespace = diff --git a/src/test/regress/expected/rules.out b/src/test/regress/expected/rules.out index cb181bd6ba..92548e6f92 100644 --- a/src/test/regress/expected/rules.out +++ b/src/test/regress/expected/rules.out @@ -1408,10 +1408,10 @@ insert into rule_and_refint_t3 values (1, 11, 12, 'row2'); insert into rule_and_refint_t3 values (1, 12, 11, 'row3'); insert into rule_and_refint_t3 values (1, 12, 12, 'row4'); insert into rule_and_refint_t3 values (1, 11, 13, 'row5'); -ERROR: insert or update on table "rule_and_refint_t3" violates foreign key constraint "$2" +ERROR: insert or update on table "rule_and_refint_t3" violates foreign key constraint "rule_and_refint_t3_id3a_fkey1" DETAIL: Key (id3a,id3c)=(1,13) is not present in table "rule_and_refint_t2". insert into rule_and_refint_t3 values (1, 13, 11, 'row6'); -ERROR: insert or update on table "rule_and_refint_t3" violates foreign key constraint "$1" +ERROR: insert or update on table "rule_and_refint_t3" violates foreign key constraint "rule_and_refint_t3_id3a_fkey" DETAIL: Key (id3a,id3b)=(1,13) is not present in table "rule_and_refint_t1". create rule rule_and_refint_t3_ins as on insert to rule_and_refint_t3 where (exists (select 1 from rule_and_refint_t3 @@ -1423,8 +1423,8 @@ create rule rule_and_refint_t3_ins as on insert to rule_and_refint_t3 and (rule_and_refint_t3.id3b = new.id3b)) and (rule_and_refint_t3.id3c = new.id3c)); insert into rule_and_refint_t3 values (1, 11, 13, 'row7'); -ERROR: insert or update on table "rule_and_refint_t3" violates foreign key constraint "$2" +ERROR: insert or update on table "rule_and_refint_t3" violates foreign key constraint "rule_and_refint_t3_id3a_fkey1" DETAIL: Key (id3a,id3c)=(1,13) is not present in table "rule_and_refint_t2". insert into rule_and_refint_t3 values (1, 13, 11, 'row8'); -ERROR: insert or update on table "rule_and_refint_t3" violates foreign key constraint "$1" +ERROR: insert or update on table "rule_and_refint_t3" violates foreign key constraint "rule_and_refint_t3_id3a_fkey" DETAIL: Key (id3a,id3b)=(1,13) is not present in table "rule_and_refint_t1". diff --git a/src/test/regress/expected/sequence.out b/src/test/regress/expected/sequence.out index d09e5db170..040506d4de 100644 --- a/src/test/regress/expected/sequence.out +++ b/src/test/regress/expected/sequence.out @@ -3,7 +3,7 @@ --- CREATE TABLE serialTest (f1 text, f2 serial); -NOTICE: CREATE TABLE will create implicit sequence "serialtest_f2_seq" for "serial" column "serialtest.f2" +NOTICE: CREATE TABLE will create implicit sequence "serialtest_f2_seq" for serial column "serialtest.f2" INSERT INTO serialTest VALUES ('foo'); INSERT INTO serialTest VALUES ('bar'); diff --git a/src/test/regress/expected/truncate.out b/src/test/regress/expected/truncate.out index 5e7d81d773..a3a0050251 100644 --- a/src/test/regress/expected/truncate.out +++ b/src/test/regress/expected/truncate.out @@ -41,7 +41,7 @@ SELECT * FROM truncate_a; TRUNCATE truncate_a; ERROR: cannot truncate a table referenced in a foreign key constraint -DETAIL: Table "truncate_b" references "truncate_a" via foreign key constraint "$1". +DETAIL: Table "truncate_b" references "truncate_a" via foreign key constraint "truncate_b_col1_fkey". SELECT * FROM truncate_a; col1 ------ diff --git a/src/test/regress/output/constraints.source b/src/test/regress/output/constraints.source index 2237e0c596..70ab60ac40 100644 --- a/src/test/regress/output/constraints.source +++ b/src/test/regress/output/constraints.source @@ -127,7 +127,7 @@ INSERT INTO INSERT_TBL(y) VALUES ('Y'); ERROR: new row for relation "insert_tbl" violates check constraint "insert_con" INSERT INTO INSERT_TBL(y) VALUES ('Y'); INSERT INTO INSERT_TBL(x,z) VALUES (1, -2); -ERROR: new row for relation "insert_tbl" violates check constraint "$1" +ERROR: new row for relation "insert_tbl" violates check constraint "insert_tbl_check" INSERT INTO INSERT_TBL(z,x) VALUES (-7, 7); INSERT INTO INSERT_TBL VALUES (5, 'check failed', -5); ERROR: new row for relation "insert_tbl" violates check constraint "insert_con" @@ -143,7 +143,7 @@ SELECT '' AS four, * FROM INSERT_TBL; (4 rows) INSERT INTO INSERT_TBL(y,z) VALUES ('check failed', 4); -ERROR: new row for relation "insert_tbl" violates check constraint "$1" +ERROR: new row for relation "insert_tbl" violates check constraint "insert_tbl_check" INSERT INTO INSERT_TBL(x,y) VALUES (5, 'check failed'); ERROR: new row for relation "insert_tbl" violates check constraint "insert_con" INSERT INTO INSERT_TBL(x,y) VALUES (5, '!check failed'); @@ -197,9 +197,9 @@ CREATE TABLE INSERT_CHILD (cx INT default 42, INHERITS (INSERT_TBL); INSERT INTO INSERT_CHILD(x,z,cy) VALUES (7,-7,11); INSERT INTO INSERT_CHILD(x,z,cy) VALUES (7,-7,6); -ERROR: new row for relation "insert_child" violates check constraint "insert_child_cy" +ERROR: new row for relation "insert_child" violates check constraint "insert_child_check" INSERT INTO INSERT_CHILD(x,z,cy) VALUES (6,-7,7); -ERROR: new row for relation "insert_child" violates check constraint "$1" +ERROR: new row for relation "insert_child" violates check constraint "insert_tbl_check" INSERT INTO INSERT_CHILD(x,y,z,cy) VALUES (6,'check failed',-6,7); ERROR: new row for relation "insert_child" violates check constraint "insert_con" SELECT * FROM INSERT_CHILD; diff --git a/src/test/regress/sql/copy2.sql b/src/test/regress/sql/copy2.sql index 35c376d1e3..70c8ea6b1e 100644 --- a/src/test/regress/sql/copy2.sql +++ b/src/test/regress/sql/copy2.sql @@ -129,6 +129,6 @@ COPY y TO stdout WITH CSV; COPY y TO stdout WITH CSV QUOTE '''' DELIMITER '|'; COPY y TO stdout WITH CSV FORCE QUOTE col2 ESCAPE '\\'; -DROP TABLE x; +DROP TABLE x, y; DROP FUNCTION fn_x_before(); DROP FUNCTION fn_x_after(); |
