Commit 5b806ecf authored by Peter Eisentraut's avatar Peter Eisentraut

Remove NOTICE about foreign key creating implicit triggers, because it no

longer conveys useful information.
parent 08c33c42
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.289 2003/09/26 15:27:32 petere Exp $ * $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.290 2003/10/02 06:32:45 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -1565,10 +1565,6 @@ transformFKConstraints(ParseState *pstate, CreateStmtContext *cxt, ...@@ -1565,10 +1565,6 @@ transformFKConstraints(ParseState *pstate, CreateStmtContext *cxt,
if (cxt->fkconstraints == NIL) if (cxt->fkconstraints == NIL)
return; return;
ereport(NOTICE,
(errmsg("%s will create implicit triggers for foreign-key checks",
cxt->stmtType)));
/* /*
* For ALTER TABLE ADD CONSTRAINT, nothing to do. For CREATE TABLE or * For ALTER TABLE ADD CONSTRAINT, nothing to do. For CREATE TABLE or
* ALTER TABLE ADD COLUMN, gin up an ALTER TABLE ADD CONSTRAINT * ALTER TABLE ADD COLUMN, gin up an ALTER TABLE ADD CONSTRAINT
......
...@@ -307,26 +307,21 @@ INSERT INTO tmp3 values (1,20); ...@@ -307,26 +307,21 @@ INSERT INTO tmp3 values (1,20);
INSERT INTO tmp3 values (5,50); INSERT INTO tmp3 values (5,50);
-- Try (and fail) to add constraint due to invalid source columns -- Try (and fail) to add constraint due to invalid source columns
ALTER TABLE tmp3 add constraint tmpconstr foreign key(c) references tmp2 match full; ALTER TABLE tmp3 add constraint tmpconstr foreign key(c) references tmp2 match full;
NOTICE: ALTER TABLE will create implicit triggers for foreign-key checks
ERROR: column "c" referenced in foreign key constraint does not exist ERROR: column "c" referenced in foreign key constraint does not exist
-- Try (and fail) to add constraint due to invalide destination columns explicitly given -- Try (and fail) to add constraint due to invalide destination columns explicitly given
ALTER TABLE tmp3 add constraint tmpconstr foreign key(a) references tmp2(b) match full; ALTER TABLE tmp3 add constraint tmpconstr foreign key(a) references tmp2(b) match full;
NOTICE: ALTER TABLE will create implicit triggers for foreign-key checks
ERROR: column "b" referenced in foreign key constraint does not exist ERROR: column "b" referenced in foreign key constraint does not exist
-- Try (and fail) to add constraint due to invalid data -- Try (and fail) to add constraint due to invalid data
ALTER TABLE tmp3 add constraint tmpconstr foreign key (a) references tmp2 match full; ALTER TABLE tmp3 add constraint tmpconstr foreign key (a) references tmp2 match full;
NOTICE: ALTER TABLE will create implicit triggers for foreign-key checks
ERROR: insert or update on table "tmp3" violates foreign key constraint "tmpconstr" ERROR: insert or update on table "tmp3" violates foreign key constraint "tmpconstr"
DETAIL: Key (a)=(5) is not present in table "tmp2". DETAIL: Key (a)=(5) is not present in table "tmp2".
-- Delete failing row -- Delete failing row
DELETE FROM tmp3 where a=5; DELETE FROM tmp3 where a=5;
-- Try (and succeed) -- Try (and succeed)
ALTER TABLE tmp3 add constraint tmpconstr foreign key (a) references tmp2 match full; ALTER TABLE tmp3 add constraint tmpconstr foreign key (a) references tmp2 match full;
NOTICE: ALTER TABLE will create implicit triggers for foreign-key checks
-- Try (and fail) to create constraint from tmp5(a) to tmp4(a) - unique constraint on -- Try (and fail) to create constraint from tmp5(a) to tmp4(a) - unique constraint on
-- tmp4 is a,b -- tmp4 is a,b
ALTER TABLE tmp5 add constraint tmpconstr foreign key(a) references tmp4(a) match full; ALTER TABLE tmp5 add constraint tmpconstr foreign key(a) references tmp4(a) match full;
NOTICE: ALTER TABLE will create implicit triggers for foreign-key checks
ERROR: there is no unique constraint matching given keys for referenced table "tmp4" ERROR: there is no unique constraint matching given keys for referenced table "tmp4"
DROP TABLE tmp5; DROP TABLE tmp5;
DROP TABLE tmp4; DROP TABLE tmp4;
...@@ -340,13 +335,11 @@ NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" fo ...@@ -340,13 +335,11 @@ NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" fo
CREATE TEMP TABLE FKTABLE (ftest1 inet); CREATE TEMP TABLE FKTABLE (ftest1 inet);
-- This next should fail, because inet=int does not exist -- This next should fail, because inet=int does not exist
ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1) references pktable; ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1) references pktable;
NOTICE: ALTER TABLE will create implicit triggers for foreign-key checks
ERROR: operator does not exist: inet = integer ERROR: operator does not exist: inet = integer
HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts. HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts.
-- This should also fail for the same reason, but here we -- This should also fail for the same reason, but here we
-- give the column name -- give the column name
ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1) references pktable(ptest1); ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1) references pktable(ptest1);
NOTICE: ALTER TABLE will create implicit triggers for foreign-key checks
ERROR: operator does not exist: inet = integer ERROR: operator does not exist: inet = integer
HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts. HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts.
-- This should succeed, even though they are different types -- This should succeed, even though they are different types
...@@ -354,10 +347,8 @@ HINT: No operator matches the given name and argument type(s). You may need to ...@@ -354,10 +347,8 @@ HINT: No operator matches the given name and argument type(s). You may need to
DROP TABLE FKTABLE; DROP TABLE FKTABLE;
CREATE TEMP TABLE FKTABLE (ftest1 varchar); CREATE TEMP TABLE FKTABLE (ftest1 varchar);
ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1) references pktable; ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1) references pktable;
NOTICE: ALTER TABLE will create implicit triggers for foreign-key checks
-- As should this -- As should this
ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1) references pktable(ptest1); ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1) references pktable(ptest1);
NOTICE: ALTER TABLE will create implicit triggers for foreign-key checks
DROP TABLE pktable cascade; DROP TABLE pktable cascade;
NOTICE: drop cascades to constraint $2 on table fktable NOTICE: drop cascades to constraint $2 on table fktable
NOTICE: drop cascades to constraint $1 on table fktable NOTICE: drop cascades to constraint $1 on table fktable
...@@ -368,7 +359,6 @@ NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" fo ...@@ -368,7 +359,6 @@ NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" fo
-- This should fail, because we just chose really odd types -- This should fail, because we just chose really odd types
CREATE TEMP TABLE FKTABLE (ftest1 cidr, ftest2 timestamp); CREATE TEMP TABLE FKTABLE (ftest1 cidr, ftest2 timestamp);
ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1, ftest2) references pktable; ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1, ftest2) references pktable;
NOTICE: ALTER TABLE will create implicit triggers for foreign-key checks
ERROR: operator does not exist: cidr = integer ERROR: operator does not exist: cidr = integer
HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts. HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts.
DROP TABLE FKTABLE; DROP TABLE FKTABLE;
...@@ -376,7 +366,6 @@ DROP TABLE FKTABLE; ...@@ -376,7 +366,6 @@ DROP TABLE FKTABLE;
CREATE TEMP TABLE FKTABLE (ftest1 cidr, ftest2 timestamp); CREATE TEMP TABLE FKTABLE (ftest1 cidr, ftest2 timestamp);
ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1, ftest2) ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1, ftest2)
references pktable(ptest1, ptest2); references pktable(ptest1, ptest2);
NOTICE: ALTER TABLE will create implicit triggers for foreign-key checks
ERROR: operator does not exist: cidr = integer ERROR: operator does not exist: cidr = integer
HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts. HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts.
DROP TABLE FKTABLE; DROP TABLE FKTABLE;
...@@ -384,13 +373,11 @@ DROP TABLE FKTABLE; ...@@ -384,13 +373,11 @@ DROP TABLE FKTABLE;
CREATE TEMP TABLE FKTABLE (ftest1 int, ftest2 inet); CREATE TEMP TABLE FKTABLE (ftest1 int, ftest2 inet);
ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1, ftest2) ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1, ftest2)
references pktable(ptest2, ptest1); references pktable(ptest2, ptest1);
NOTICE: ALTER TABLE will create implicit triggers for foreign-key checks
ERROR: operator does not exist: integer = inet ERROR: operator does not exist: integer = inet
HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts. HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts.
-- As does this... -- As does this...
ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest2, ftest1) ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest2, ftest1)
references pktable(ptest1, ptest2); references pktable(ptest1, ptest2);
NOTICE: ALTER TABLE will create implicit triggers for foreign-key checks
ERROR: operator does not exist: inet = integer ERROR: operator does not exist: inet = integer
HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts. HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts.
-- temp tables should go away by themselves, need not drop them. -- temp tables should go away by themselves, need not drop them.
...@@ -907,16 +894,12 @@ ERROR: column "........pg.dropped.1........" does not exist ...@@ -907,16 +894,12 @@ ERROR: column "........pg.dropped.1........" does not exist
create table atacc2 (id int4 unique); create table atacc2 (id int4 unique);
NOTICE: CREATE TABLE / UNIQUE will create implicit index "atacc2_id_key" for table "atacc2" NOTICE: CREATE TABLE / UNIQUE will create implicit index "atacc2_id_key" for table "atacc2"
alter table atacc1 add foreign key (a) references atacc2(id); alter table atacc1 add foreign key (a) references atacc2(id);
NOTICE: ALTER TABLE will create implicit triggers for foreign-key checks
ERROR: column "a" referenced in foreign key constraint does not exist ERROR: column "a" referenced in foreign key constraint does not exist
alter table atacc1 add foreign key ("........pg.dropped.1........") references atacc2(id); alter table atacc1 add foreign key ("........pg.dropped.1........") references atacc2(id);
NOTICE: ALTER TABLE will create implicit triggers for foreign-key checks
ERROR: column "........pg.dropped.1........" referenced in foreign key constraint does not exist ERROR: column "........pg.dropped.1........" referenced in foreign key constraint does not exist
alter table atacc2 add foreign key (id) references atacc1(a); alter table atacc2 add foreign key (id) references atacc1(a);
NOTICE: ALTER TABLE will create implicit triggers for foreign-key checks
ERROR: column "a" referenced in foreign key constraint does not exist ERROR: column "a" referenced in foreign key constraint does not exist
alter table atacc2 add foreign key (id) references atacc1("........pg.dropped.1........"); alter table atacc2 add foreign key (id) references atacc1("........pg.dropped.1........");
NOTICE: ALTER TABLE will create implicit triggers for foreign-key checks
ERROR: column "........pg.dropped.1........" referenced in foreign key constraint does not exist ERROR: column "........pg.dropped.1........" referenced in foreign key constraint does not exist
drop table atacc2; drop table atacc2;
create index "testing_idx" on atacc1(a); create index "testing_idx" on atacc1(a);
......
...@@ -12,7 +12,6 @@ CREATE TABLE clstr_tst (a SERIAL PRIMARY KEY, ...@@ -12,7 +12,6 @@ CREATE TABLE clstr_tst (a SERIAL PRIMARY KEY,
CONSTRAINT clstr_tst_con FOREIGN KEY (b) REFERENCES clstr_tst_s); 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" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "clstr_tst_pkey" for table "clstr_tst"
NOTICE: CREATE TABLE will create implicit triggers for foreign-key checks
CREATE INDEX clstr_tst_b ON clstr_tst (b); CREATE INDEX clstr_tst_b ON clstr_tst (b);
CREATE INDEX clstr_tst_c ON clstr_tst (c); CREATE INDEX clstr_tst_c ON clstr_tst (c);
CREATE INDEX clstr_tst_c_b ON clstr_tst (c,b); CREATE INDEX clstr_tst_c_b ON clstr_tst (c,b);
......
This diff is collapsed.
...@@ -32,7 +32,6 @@ SELECT * FROM truncate_a; ...@@ -32,7 +32,6 @@ SELECT * FROM truncate_a;
-- Test foreign constraint check -- Test foreign constraint check
CREATE TABLE truncate_b(col1 integer references truncate_a); CREATE TABLE truncate_b(col1 integer references truncate_a);
NOTICE: CREATE TABLE will create implicit triggers for foreign-key checks
INSERT INTO truncate_a VALUES (1); INSERT INTO truncate_a VALUES (1);
SELECT * FROM truncate_a; SELECT * FROM truncate_a;
col1 col1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment