Index: src/backend/commands/command.c =================================================================== RCS file: /cvsroot/pgsql/src/backend/commands/command.c,v retrieving revision 1.147 diff -c -r1.147 command.c *** src/backend/commands/command.c 2001/10/28 06:25:42 1.147 --- src/backend/commands/command.c 2001/10/29 18:26:52 *************** *** 1432,1438 **** 0, 0, 0); if (!HeapTupleIsValid(indexTuple)) ! elog(ERROR, "ALTER TABLE/ADD CONSTRAINT: Index \"%u\" not found", indexoid); indexStruct = (Form_pg_index) GETSTRUCT(indexTuple); --- 1432,1438 ---- 0, 0, 0); if (!HeapTupleIsValid(indexTuple)) ! elog(ERROR, "ALTER TABLE / ADD CONSTRAINT: Index \"%u\" not found", indexoid); indexStruct = (Form_pg_index) GETSTRUCT(indexTuple); *************** *** 1510,1516 **** NIL); /* Issue notice */ ! elog(NOTICE, "ALTER TABLE/ADD UNIQUE will create implicit index '%s' for table '%s'", iname, relationName); if (index_found) elog(NOTICE, "Unique constraint supercedes existing index on relation \"%s\". Drop the existing index to remove redundancy.", relationName); --- 1510,1516 ---- NIL); /* Issue notice */ ! elog(NOTICE, "ALTER TABLE / ADD UNIQUE will create implicit index '%s' for table '%s'", iname, relationName); if (index_found) elog(NOTICE, "Unique constraint supercedes existing index on relation \"%s\". Drop the existing index to remove redundancy.", relationName); Index: src/backend/parser/analyze.c =================================================================== RCS file: /cvsroot/pgsql/src/backend/parser/analyze.c,v retrieving revision 1.205 diff -c -r1.205 analyze.c *** src/backend/parser/analyze.c 2001/10/28 06:25:46 1.205 --- src/backend/parser/analyze.c 2001/10/29 18:26:54 *************** *** 1291,1298 **** elog(ERROR, "%s: failed to make implicit index name", cxt->stmtType); ! elog(NOTICE, "%s/%s will create implicit index '%s' for table '%s'", ! cxt->stmtType, (index->primary ? "PRIMARY KEY" : "UNIQUE"), index->idxname, cxt->relname); } } --- 1291,1298 ---- elog(ERROR, "%s: failed to make implicit index name", cxt->stmtType); ! elog(NOTICE, "%s / %s will create implicit index '%s' for table '%s'", ! cxt->stmtType, (index->primary ? "PRIMARY KEY" : "ADD UNIQUE"), index->idxname, cxt->relname); } } Index: src/backend/parser/gram.y =================================================================== RCS file: /cvsroot/pgsql/src/backend/parser/gram.y,v retrieving revision 2.270 diff -c -r2.270 gram.y *** src/backend/parser/gram.y 2001/10/23 02:50:41 2.270 --- src/backend/parser/gram.y 2001/10/29 18:27:02 *************** *** 1300,1306 **** n->constraints = $3; if ($4 != NULL) ! elog(NOTICE,"CREATE TABLE/COLLATE %s not yet implemented" "; clause ignored", $4); $$ = (Node *)n; --- 1300,1306 ---- n->constraints = $3; if ($4 != NULL) ! elog(NOTICE,"CREATE TABLE / COLLATE %s not yet implemented" "; clause ignored", $4); $$ = (Node *)n; *************** *** 1611,1617 **** */ SelectStmt *n = findLeftmostSelect((SelectStmt *) $7); if (n->into != NULL) ! elog(ERROR,"CREATE TABLE/AS SELECT may not specify INTO"); n->istemp = $2; n->into = $4; if ($5 != NIL) --- 1611,1617 ---- */ SelectStmt *n = findLeftmostSelect((SelectStmt *) $7); if (n->into != NULL) ! elog(ERROR,"CREATE TABLE / AS SELECT may not specify INTO"); n->istemp = $2; n->into = $4; if ($5 != NIL) *************** *** 6113,6119 **** ResTarget *d; if (length(src) != length(dst)) ! elog(ERROR,"CREATE TABLE/AS SELECT has mismatched column count"); while ((src != NIL) && (dst != NIL)) { --- 6113,6119 ---- ResTarget *d; if (length(src) != length(dst)) ! elog(ERROR,"CREATE TABLE / AS SELECT has mismatched column count"); while ((src != NIL) && (dst != NIL)) { Index: src/interfaces/ecpg/lib/connect.c =================================================================== RCS file: /cvsroot/pgsql/src/interfaces/ecpg/lib/connect.c,v retrieving revision 1.13 diff -c -r1.13 connect.c *** src/interfaces/ecpg/lib/connect.c 2001/10/25 05:50:11 1.13 --- src/interfaces/ecpg/lib/connect.c 2001/10/29 18:27:03 *************** *** 205,211 **** /* these are harmless - do nothing */ /* ! * NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index '*' * for table '*' */ --- 205,211 ---- /* these are harmless - do nothing */ /* ! * NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index '*' * for table '*' */ Index: src/interfaces/ecpg/preproc/preproc.y =================================================================== RCS file: /cvsroot/pgsql/src/interfaces/ecpg/preproc/preproc.y,v retrieving revision 1.165 diff -c -r1.165 preproc.y *** src/interfaces/ecpg/preproc/preproc.y 2001/10/25 20:56:53 1.165 --- src/interfaces/ecpg/preproc/preproc.y 2001/10/29 18:27:08 *************** *** 1087,1097 **** | LOCAL TEMPORARY { $$ = make_str("local temporary"); } | LOCAL TEMP { $$ = make_str("local temp"); } | GLOBAL TEMPORARY { ! mmerror(ET_NOTICE, "Currently unsupported CREATE TABLE/GLOBAL TEMPORARY will be passed to backend"); $$ = make_str("global temporary"); } | GLOBAL TEMP { ! mmerror(ET_NOTICE, "Currently unsupported CREATE TABLE/GLOBAL TEMP will be passed to backend"); $$ = make_str("global temp"); } | /*EMPTY*/ { $$ = EMPTY; } --- 1087,1097 ---- | LOCAL TEMPORARY { $$ = make_str("local temporary"); } | LOCAL TEMP { $$ = make_str("local temp"); } | GLOBAL TEMPORARY { ! mmerror(ET_NOTICE, "Currently unsupported CREATE TABLE / GLOBAL TEMPORARY will be passed to backend"); $$ = make_str("global temporary"); } | GLOBAL TEMP { ! mmerror(ET_NOTICE, "Currently unsupported CREATE TABLE / GLOBAL TEMP will be passed to backend"); $$ = make_str("global temp"); } | /*EMPTY*/ { $$ = EMPTY; } *************** *** 1116,1122 **** { if (strlen($4) > 0) { ! sprintf(errortext, "Currently unsupported CREATE TABLE/COLLATE %s will be passed to backend", $4); mmerror(ET_NOTICE, errortext); } $$ = cat_str(4, $1, $2, $3, $4); --- 1116,1122 ---- { if (strlen($4) > 0) { ! sprintf(errortext, "Currently unsupported CREATE TABLE / COLLATE %s will be passed to backend", $4); mmerror(ET_NOTICE, errortext); } $$ = cat_str(4, $1, $2, $3, $4); *************** *** 1278,1284 **** { FoundInto = 0; } SelectStmt { if (FoundInto == 1) ! mmerror(ET_ERROR, "CREATE TABLE/AS SELECT may not specify INTO"); $$ = cat_str(7, make_str("create"), $2, make_str("table"), $4, $5, make_str("as"), $8); } --- 1278,1284 ---- { FoundInto = 0; } SelectStmt { if (FoundInto == 1) ! mmerror(ET_ERROR, "CREATE TABLE / AS SELECT may not specify INTO"); $$ = cat_str(7, make_str("create"), $2, make_str("table"), $4, $5, make_str("as"), $8); } *************** *** 2626,2637 **** } | GLOBAL TEMPORARY opt_table relation_name { ! mmerror(ET_NOTICE, "Currently unsupported CREATE TABLE/GLOBAL TEMPORARY will be passed to backend"); $$ = cat_str(3, make_str("global temporary"), $3, $4); } | GLOBAL TEMP opt_table relation_name { ! mmerror(ET_NOTICE, "Currently unsupported CREATE TABLE/GLOBAL TEMP will be passed to backend"); $$ = cat_str(3, make_str("global temp"), $3, $4); } | TABLE relation_name --- 2626,2637 ---- } | GLOBAL TEMPORARY opt_table relation_name { ! mmerror(ET_NOTICE, "Currently unsupported CREATE TABLE / GLOBAL TEMPORARY will be passed to backend"); $$ = cat_str(3, make_str("global temporary"), $3, $4); } | GLOBAL TEMP opt_table relation_name { ! mmerror(ET_NOTICE, "Currently unsupported CREATE TABLE / GLOBAL TEMP will be passed to backend"); $$ = cat_str(3, make_str("global temp"), $3, $4); } | TABLE relation_name Index: src/test/regress/expected/alter_table.out =================================================================== RCS file: /cvsroot/pgsql/src/test/regress/expected/alter_table.out,v retrieving revision 1.24 diff -c -r1.24 alter_table.out *** src/test/regress/expected/alter_table.out 2001/10/12 00:07:15 1.24 --- src/test/regress/expected/alter_table.out 2001/10/29 18:27:09 *************** *** 271,280 **** -- FOREIGN KEY CONSTRAINT adding TEST CREATE TABLE tmp2 (a int primary key); ! NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'tmp2_pkey' for table 'tmp2' CREATE TABLE tmp3 (a int, b int); CREATE TABLE tmp4 (a int, b int, unique(a,b)); ! NOTICE: CREATE TABLE/UNIQUE will create implicit index 'tmp4_a_key' for table 'tmp4' CREATE TABLE tmp5 (a int, b int); -- Insert rows into tmp2 (pktable) INSERT INTO tmp2 values (1); --- 271,280 ---- -- FOREIGN KEY CONSTRAINT adding TEST CREATE TABLE tmp2 (a int primary key); ! NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'tmp2_pkey' for table 'tmp2' CREATE TABLE tmp3 (a int, b int); CREATE TABLE tmp4 (a int, b int, unique(a,b)); ! NOTICE: CREATE TABLE / ADD UNIQUE will create implicit index 'tmp4_a_key' for table 'tmp4' CREATE TABLE tmp5 (a int, b int); -- Insert rows into tmp2 (pktable) INSERT INTO tmp2 values (1); *************** *** 317,323 **** -- Note: these tables are TEMP to avoid name conflicts when this test -- is run in parallel with foreign_key.sql. CREATE TEMP TABLE PKTABLE (ptest1 int PRIMARY KEY); ! NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable' CREATE TEMP TABLE FKTABLE (ftest1 text); -- This next should fail, because text=int does not exist ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1) references pktable; --- 317,323 ---- -- Note: these tables are TEMP to avoid name conflicts when this test -- is run in parallel with foreign_key.sql. CREATE TEMP TABLE PKTABLE (ptest1 int PRIMARY KEY); ! NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable' CREATE TEMP TABLE FKTABLE (ftest1 text); -- This next should fail, because text=int does not exist ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1) references pktable; *************** *** 345,351 **** DROP TABLE fktable; CREATE TEMP TABLE PKTABLE (ptest1 int, ptest2 text, 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 TEMP TABLE FKTABLE (ftest1 cidr, ftest2 datetime); ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1, ftest2) references pktable; --- 345,351 ---- DROP TABLE fktable; CREATE TEMP TABLE PKTABLE (ptest1 int, ptest2 text, 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 TEMP TABLE FKTABLE (ftest1 cidr, ftest2 datetime); ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1, ftest2) references pktable; Index: src/test/regress/expected/create_misc.out =================================================================== RCS file: /cvsroot/pgsql/src/test/regress/expected/create_misc.out,v retrieving revision 1.9 diff -c -r1.9 create_misc.out *** src/test/regress/expected/create_misc.out 2001/05/21 16:54:46 1.9 --- src/test/regress/expected/create_misc.out 2001/10/29 18:27:09 *************** *** 137,143 **** --- 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/UNIQUE will create implicit index 'serialtest_f2_key' for table 'serialtest' INSERT INTO serialTest VALUES ('foo'); INSERT INTO serialTest VALUES ('bar'); INSERT INTO serialTest VALUES ('force', 100); --- 137,143 ---- --- 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 / ADD UNIQUE will create implicit index 'serialtest_f2_key' for table 'serialtest' INSERT INTO serialTest VALUES ('foo'); INSERT INTO serialTest VALUES ('bar'); INSERT INTO serialTest VALUES ('force', 100); Index: src/test/regress/expected/foreign_key.out =================================================================== RCS file: /cvsroot/pgsql/src/test/regress/expected/foreign_key.out,v retrieving revision 1.8 diff -c -r1.8 foreign_key.out *** src/test/regress/expected/foreign_key.out 2001/10/12 00:07:15 1.8 --- src/test/regress/expected/foreign_key.out 2001/10/29 18:27:09 *************** *** 6,12 **** -- First test, check and cascade -- CREATE TABLE PKTABLE ( ptest1 int PRIMARY KEY, ptest2 text ); ! NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable' CREATE TABLE FKTABLE ( ftest1 int REFERENCES PKTABLE MATCH FULL ON DELETE CASCADE ON UPDATE CASCADE, ftest2 int ); NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) -- Insert test data into PKTABLE --- 6,12 ---- -- First test, check and cascade -- CREATE TABLE PKTABLE ( ptest1 int PRIMARY KEY, ptest2 text ); ! NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable' CREATE TABLE FKTABLE ( ftest1 int REFERENCES PKTABLE MATCH FULL ON DELETE CASCADE ON UPDATE CASCADE, ftest2 int ); NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) -- Insert test data into PKTABLE *************** *** 62,68 **** -- check set NULL and table constraint on multiple columns -- CREATE TABLE PKTABLE ( ptest1 int, ptest2 int, ptest3 text, PRIMARY KEY(ptest1, ptest2) ); ! NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable' CREATE TABLE FKTABLE ( ftest1 int, ftest2 int, ftest3 int, CONSTRAINT constrname FOREIGN KEY(ftest1, ftest2) REFERENCES PKTABLE MATCH FULL ON DELETE SET NULL ON UPDATE SET NULL); NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) --- 62,68 ---- -- check set NULL and table constraint on multiple columns -- CREATE TABLE PKTABLE ( ptest1 int, ptest2 int, ptest3 text, PRIMARY KEY(ptest1, ptest2) ); ! NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable' CREATE TABLE FKTABLE ( ftest1 int, ftest2 int, ftest3 int, CONSTRAINT constrname FOREIGN KEY(ftest1, ftest2) REFERENCES PKTABLE MATCH FULL ON DELETE SET NULL ON UPDATE SET NULL); NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) *************** *** 145,151 **** -- check set default and table constraint on multiple columns -- CREATE TABLE PKTABLE ( ptest1 int, ptest2 int, ptest3 text, PRIMARY KEY(ptest1, ptest2) ); ! NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable' CREATE TABLE FKTABLE ( ftest1 int DEFAULT -1, ftest2 int DEFAULT -2, ftest3 int, CONSTRAINT constrname2 FOREIGN KEY(ftest1, ftest2) REFERENCES PKTABLE MATCH FULL ON DELETE SET DEFAULT ON UPDATE SET DEFAULT); NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) --- 145,151 ---- -- check set default and table constraint on multiple columns -- CREATE TABLE PKTABLE ( ptest1 int, ptest2 int, ptest3 text, PRIMARY KEY(ptest1, ptest2) ); ! NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable' CREATE TABLE FKTABLE ( ftest1 int DEFAULT -1, ftest2 int DEFAULT -2, ftest3 int, CONSTRAINT constrname2 FOREIGN KEY(ftest1, ftest2) REFERENCES PKTABLE MATCH FULL ON DELETE SET DEFAULT ON UPDATE SET DEFAULT); NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) *************** *** 230,236 **** -- First test, check with no on delete or on update -- CREATE TABLE PKTABLE ( ptest1 int PRIMARY KEY, ptest2 text ); ! NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable' CREATE TABLE FKTABLE ( ftest1 int REFERENCES PKTABLE MATCH FULL, ftest2 int ); NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) -- Insert test data into PKTABLE --- 230,236 ---- -- First test, check with no on delete or on update -- CREATE TABLE PKTABLE ( ptest1 int PRIMARY KEY, ptest2 text ); ! NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable' CREATE TABLE FKTABLE ( ftest1 int REFERENCES PKTABLE MATCH FULL, ftest2 int ); NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) -- Insert test data into PKTABLE *************** *** 304,310 **** -- MATCH unspecified -- Base test restricting update/delete CREATE TABLE PKTABLE ( ptest1 int, ptest2 int, ptest3 int, ptest4 text, PRIMARY KEY(ptest1, ptest2, ptest3) ); ! NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable' CREATE TABLE FKTABLE ( ftest1 int, ftest2 int, ftest3 int, ftest4 int, CONSTRAINT constrname3 FOREIGN KEY(ftest1, ftest2, ftest3) REFERENCES PKTABLE); NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) --- 304,310 ---- -- MATCH unspecified -- Base test restricting update/delete CREATE TABLE PKTABLE ( ptest1 int, ptest2 int, ptest3 int, ptest4 text, PRIMARY KEY(ptest1, ptest2, ptest3) ); ! NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable' CREATE TABLE FKTABLE ( ftest1 int, ftest2 int, ftest3 int, ftest4 int, CONSTRAINT constrname3 FOREIGN KEY(ftest1, ftest2, ftest3) REFERENCES PKTABLE); NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) *************** *** 368,374 **** DROP TABLE PKTABLE; -- cascade update/delete CREATE TABLE PKTABLE ( ptest1 int, ptest2 int, ptest3 int, ptest4 text, PRIMARY KEY(ptest1, ptest2, ptest3) ); ! NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable' CREATE TABLE FKTABLE ( ftest1 int, ftest2 int, ftest3 int, ftest4 int, CONSTRAINT constrname3 FOREIGN KEY(ftest1, ftest2, ftest3) REFERENCES PKTABLE ON DELETE CASCADE ON UPDATE CASCADE); --- 368,374 ---- DROP TABLE PKTABLE; -- cascade update/delete CREATE TABLE PKTABLE ( ptest1 int, ptest2 int, ptest3 int, ptest4 text, PRIMARY KEY(ptest1, ptest2, ptest3) ); ! NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable' CREATE TABLE FKTABLE ( ftest1 int, ftest2 int, ftest3 int, ftest4 int, CONSTRAINT constrname3 FOREIGN KEY(ftest1, ftest2, ftest3) REFERENCES PKTABLE ON DELETE CASCADE ON UPDATE CASCADE); *************** *** 467,473 **** DROP TABLE PKTABLE; -- set null update / set default delete CREATE TABLE PKTABLE ( ptest1 int, ptest2 int, ptest3 int, ptest4 text, PRIMARY KEY(ptest1, ptest2, ptest3) ); ! NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable' CREATE TABLE FKTABLE ( ftest1 int DEFAULT 0, ftest2 int, ftest3 int, ftest4 int, CONSTRAINT constrname3 FOREIGN KEY(ftest1, ftest2, ftest3) REFERENCES PKTABLE ON DELETE SET DEFAULT ON UPDATE SET NULL); --- 467,473 ---- DROP TABLE PKTABLE; -- set null update / set default delete CREATE TABLE PKTABLE ( ptest1 int, ptest2 int, ptest3 int, ptest4 text, PRIMARY KEY(ptest1, ptest2, ptest3) ); ! NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable' CREATE TABLE FKTABLE ( ftest1 int DEFAULT 0, ftest2 int, ftest3 int, ftest4 int, CONSTRAINT constrname3 FOREIGN KEY(ftest1, ftest2, ftest3) REFERENCES PKTABLE ON DELETE SET DEFAULT ON UPDATE SET NULL); *************** *** 573,579 **** DROP TABLE PKTABLE; -- set default update / set null delete CREATE TABLE PKTABLE ( ptest1 int, ptest2 int, ptest3 int, ptest4 text, PRIMARY KEY(ptest1, ptest2, ptest3) ); ! NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable' CREATE TABLE FKTABLE ( ftest1 int DEFAULT 0, ftest2 int DEFAULT -1, ftest3 int, ftest4 int, CONSTRAINT constrname3 FOREIGN KEY(ftest1, ftest2, ftest3) REFERENCES PKTABLE ON DELETE SET NULL ON UPDATE SET DEFAULT); --- 573,579 ---- DROP TABLE PKTABLE; -- set default update / set null delete CREATE TABLE PKTABLE ( ptest1 int, ptest2 int, ptest3 int, ptest4 text, PRIMARY KEY(ptest1, ptest2, ptest3) ); ! NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable' CREATE TABLE FKTABLE ( ftest1 int DEFAULT 0, ftest2 int DEFAULT -1, ftest3 int, ftest4 int, CONSTRAINT constrname3 FOREIGN KEY(ftest1, ftest2, ftest3) REFERENCES PKTABLE ON DELETE SET NULL ON UPDATE SET DEFAULT); *************** *** 691,697 **** NOTICE: DROP TABLE implicitly drops referential integrity trigger from table "pktable" DROP TABLE PKTABLE; CREATE TABLE PKTABLE (ptest1 int PRIMARY KEY); ! NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable' CREATE TABLE FKTABLE_FAIL1 ( ftest1 int, CONSTRAINT fkfail1 FOREIGN KEY (ftest2) REFERENCES PKTABLE); NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) ERROR: CREATE TABLE: column "ftest2" referenced in foreign key constraint does not exist --- 691,697 ---- NOTICE: DROP TABLE implicitly drops referential integrity trigger from table "pktable" DROP TABLE PKTABLE; CREATE TABLE PKTABLE (ptest1 int PRIMARY KEY); ! NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable' CREATE TABLE FKTABLE_FAIL1 ( ftest1 int, CONSTRAINT fkfail1 FOREIGN KEY (ftest2) REFERENCES PKTABLE); NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) ERROR: CREATE TABLE: column "ftest2" referenced in foreign key constraint does not exist *************** *** 705,711 **** DROP TABLE PKTABLE; -- Test for referencing column number smaller than referenced constraint CREATE TABLE PKTABLE (ptest1 int, ptest2 int, UNIQUE(ptest1, ptest2)); ! NOTICE: CREATE TABLE/UNIQUE will create implicit index 'pktable_ptest1_key' for table 'pktable' CREATE TABLE FKTABLE_FAIL1 (ftest1 int REFERENCES pktable(ptest1)); NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) ERROR: UNIQUE constraint matching given keys for referenced table "pktable" not found --- 705,711 ---- DROP TABLE PKTABLE; -- Test for referencing column number smaller than referenced constraint CREATE TABLE PKTABLE (ptest1 int, ptest2 int, UNIQUE(ptest1, ptest2)); ! NOTICE: CREATE TABLE / ADD UNIQUE will create implicit index 'pktable_ptest1_key' for table 'pktable' CREATE TABLE FKTABLE_FAIL1 (ftest1 int REFERENCES pktable(ptest1)); NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) ERROR: UNIQUE constraint matching given keys for referenced table "pktable" not found *************** *** 717,723 **** -- -- Basic one column, two table setup 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 text=int does not exist CREATE TABLE FKTABLE (ftest1 text REFERENCES pktable); NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) --- 717,723 ---- -- -- Basic one column, two table setup 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 text=int does not exist CREATE TABLE FKTABLE (ftest1 text REFERENCES pktable); NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) *************** *** 745,751 **** DROP TABLE PKTABLE; -- Two columns, two tables CREATE TABLE PKTABLE (ptest1 int, ptest2 text, 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 datetime, FOREIGN KEY(ftest1, ftest2) REFERENCES pktable); NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) --- 745,751 ---- DROP TABLE PKTABLE; -- Two columns, two tables CREATE TABLE PKTABLE (ptest1 int, ptest2 text, 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 datetime, FOREIGN KEY(ftest1, ftest2) REFERENCES pktable); NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) *************** *** 788,820 **** -- Make sure this still works... CREATE TABLE PKTABLE (ptest1 int, ptest2 text, ptest3 int, ptest4 text, PRIMARY KEY(ptest1, ptest2), FOREIGN KEY(ptest3, ptest4) REFERENCES pktable(ptest1, ptest2)); ! NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable' NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) DROP TABLE PKTABLE; -- And this, CREATE TABLE PKTABLE (ptest1 int, ptest2 text, ptest3 int, ptest4 text, PRIMARY KEY(ptest1, ptest2), FOREIGN KEY(ptest3, ptest4) REFERENCES pktable); ! NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable' NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) DROP TABLE PKTABLE; -- This shouldn't (mixed up columns) CREATE TABLE PKTABLE (ptest1 int, ptest2 text, ptest3 int, ptest4 text, 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' NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) ERROR: Unable to identify an operator '=' for types 'integer' and 'text' You will have to retype this query using an explicit cast -- Nor should this... (same reason, we have 4,3 referencing 1,2 which mismatches types CREATE TABLE PKTABLE (ptest1 int, ptest2 text, ptest3 int, ptest4 text, 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' NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) ERROR: Unable to identify an operator '=' for types 'text' and 'integer' You will have to retype this query using an explicit cast -- Not this one either... Same as the last one except we didn't defined the columns being referenced. CREATE TABLE PKTABLE (ptest1 int, ptest2 text, ptest3 int, ptest4 text, PRIMARY KEY(ptest1, ptest2), FOREIGN KEY(ptest4, ptest3) REFERENCES pktable); ! NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable' NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) ERROR: Unable to identify an operator '=' for types 'text' and 'integer' You will have to retype this query using an explicit cast --- 788,820 ---- -- Make sure this still works... CREATE TABLE PKTABLE (ptest1 int, ptest2 text, ptest3 int, ptest4 text, PRIMARY KEY(ptest1, ptest2), FOREIGN KEY(ptest3, ptest4) REFERENCES pktable(ptest1, ptest2)); ! NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable' NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) DROP TABLE PKTABLE; -- And this, CREATE TABLE PKTABLE (ptest1 int, ptest2 text, ptest3 int, ptest4 text, PRIMARY KEY(ptest1, ptest2), FOREIGN KEY(ptest3, ptest4) REFERENCES pktable); ! NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable' NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) DROP TABLE PKTABLE; -- This shouldn't (mixed up columns) CREATE TABLE PKTABLE (ptest1 int, ptest2 text, ptest3 int, ptest4 text, 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' NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) ERROR: Unable to identify an operator '=' for types 'integer' and 'text' You will have to retype this query using an explicit cast -- Nor should this... (same reason, we have 4,3 referencing 1,2 which mismatches types CREATE TABLE PKTABLE (ptest1 int, ptest2 text, ptest3 int, ptest4 text, 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' NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) ERROR: Unable to identify an operator '=' for types 'text' and 'integer' You will have to retype this query using an explicit cast -- Not this one either... Same as the last one except we didn't defined the columns being referenced. CREATE TABLE PKTABLE (ptest1 int, ptest2 text, ptest3 int, ptest4 text, PRIMARY KEY(ptest1, ptest2), FOREIGN KEY(ptest4, ptest3) REFERENCES pktable); ! NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable' NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) ERROR: Unable to identify an operator '=' for types 'text' and 'integer' You will have to retype this query using an explicit cast *************** *** 823,830 **** -- Basic 2 table case: 1 column of matching types. create table pktable_base (base1 int not null); create table pktable (ptest1 int, primary key(base1), unique(base1, ptest1)) inherits (pktable_base); ! NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable' ! NOTICE: CREATE TABLE/UNIQUE will create implicit index 'pktable_base1_key' for table 'pktable' create table fktable (ftest1 int references pktable(base1)); NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) -- now some ins, upd, del --- 823,830 ---- -- Basic 2 table case: 1 column of matching types. create table pktable_base (base1 int not null); create table pktable (ptest1 int, primary key(base1), unique(base1, ptest1)) inherits (pktable_base); ! NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable' ! NOTICE: CREATE TABLE / ADD UNIQUE will create implicit index 'pktable_base1_key' for table 'pktable' create table fktable (ftest1 int references pktable(base1)); NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) -- now some ins, upd, del *************** *** 885,891 **** create table pktable_base(base1 int not null, base2 int); create table pktable(ptest1 int, ptest2 int, 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' NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) insert into pktable (base1, ptest1, base2, ptest2) values (1, 1, 1, 1); insert into pktable (base1, ptest1, base2, ptest2) values (2, 1, 1, 1); --- 885,891 ---- create table pktable_base(base1 int not null, base2 int); create table pktable(ptest1 int, ptest2 int, 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' NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) insert into pktable (base1, ptest1, base2, ptest2) values (1, 1, 1, 1); insert into pktable (base1, ptest1, base2, ptest2) values (2, 1, 1, 1); *************** *** 908,914 **** -- 2 columns (2 tables), mismatched types create table pktable_base(base1 int not null); create table pktable(ptest1 text, primary key(base1, ptest1)) inherits (pktable_base); ! 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); NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) --- 908,914 ---- -- 2 columns (2 tables), mismatched types create table pktable_base(base1 int not null); create table pktable(ptest1 text, primary key(base1, ptest1)) inherits (pktable_base); ! 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); NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) *************** *** 937,961 **** create table pktable_base(base1 int not null, base2 int); create table pktable(ptest1 text, ptest2 text[], 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' NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) ERROR: Unable to identify an operator '=' for types 'text[]' and 'text' You will have to retype this query using an explicit cast create table pktable(ptest1 text, ptest2 text, 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' NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) ERROR: Unable to identify an operator '=' for types 'integer' and 'text' You will have to retype this query using an explicit cast create table pktable(ptest1 text, ptest2 text, 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' NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) ERROR: Unable to identify an operator '=' for types 'text' and 'integer' You will have to retype this query using an explicit cast create table pktable(ptest1 text, ptest2 text, 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' NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) ERROR: Unable to identify an operator '=' for types 'text' and 'integer' You will have to retype this query using an explicit cast --- 937,961 ---- create table pktable_base(base1 int not null, base2 int); create table pktable(ptest1 text, ptest2 text[], 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' NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) ERROR: Unable to identify an operator '=' for types 'text[]' and 'text' You will have to retype this query using an explicit cast create table pktable(ptest1 text, ptest2 text, 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' NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) ERROR: Unable to identify an operator '=' for types 'integer' and 'text' You will have to retype this query using an explicit cast create table pktable(ptest1 text, ptest2 text, 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' NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) ERROR: Unable to identify an operator '=' for types 'text' and 'integer' You will have to retype this query using an explicit cast create table pktable(ptest1 text, ptest2 text, 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' NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) ERROR: Unable to identify an operator '=' for types 'text' and 'integer' You will have to retype this query using an explicit cast Index: src/test/regress/output/constraints.source =================================================================== RCS file: /cvsroot/pgsql/src/test/regress/output/constraints.source,v retrieving revision 1.18 diff -c -r1.18 constraints.source *** src/test/regress/output/constraints.source 2001/02/22 05:32:56 1.18 --- src/test/regress/output/constraints.source 2001/10/29 18:27:09 *************** *** 286,292 **** -- Primary keys -- CREATE TABLE PRIMARY_TBL (i int PRIMARY KEY, t text); ! NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'primary_tbl_pkey' for table 'primary_tbl' INSERT INTO PRIMARY_TBL VALUES (1, 'one'); INSERT INTO PRIMARY_TBL VALUES (2, 'two'); INSERT INTO PRIMARY_TBL VALUES (1, 'three'); --- 286,292 ---- -- Primary keys -- CREATE TABLE PRIMARY_TBL (i int PRIMARY KEY, t text); ! NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'primary_tbl_pkey' for table 'primary_tbl' INSERT INTO PRIMARY_TBL VALUES (1, 'one'); INSERT INTO PRIMARY_TBL VALUES (2, 'two'); INSERT INTO PRIMARY_TBL VALUES (1, 'three'); *************** *** 307,313 **** DROP TABLE PRIMARY_TBL; CREATE TABLE PRIMARY_TBL (i int, t text, PRIMARY KEY(i,t)); ! NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'primary_tbl_pkey' for table 'primary_tbl' INSERT INTO PRIMARY_TBL VALUES (1, 'one'); INSERT INTO PRIMARY_TBL VALUES (2, 'two'); INSERT INTO PRIMARY_TBL VALUES (1, 'three'); --- 307,313 ---- DROP TABLE PRIMARY_TBL; CREATE TABLE PRIMARY_TBL (i int, t text, PRIMARY KEY(i,t)); ! NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'primary_tbl_pkey' for table 'primary_tbl' INSERT INTO PRIMARY_TBL VALUES (1, 'one'); INSERT INTO PRIMARY_TBL VALUES (2, 'two'); INSERT INTO PRIMARY_TBL VALUES (1, 'three'); *************** *** 330,336 **** -- Unique keys -- CREATE TABLE UNIQUE_TBL (i int UNIQUE, t text); ! NOTICE: CREATE TABLE/UNIQUE will create implicit index 'unique_tbl_i_key' for table 'unique_tbl' INSERT INTO UNIQUE_TBL VALUES (1, 'one'); INSERT INTO UNIQUE_TBL VALUES (2, 'two'); INSERT INTO UNIQUE_TBL VALUES (1, 'three'); --- 330,336 ---- -- Unique keys -- CREATE TABLE UNIQUE_TBL (i int UNIQUE, t text); ! NOTICE: CREATE TABLE / ADD UNIQUE will create implicit index 'unique_tbl_i_key' for table 'unique_tbl' INSERT INTO UNIQUE_TBL VALUES (1, 'one'); INSERT INTO UNIQUE_TBL VALUES (2, 'two'); INSERT INTO UNIQUE_TBL VALUES (1, 'three'); *************** *** 353,359 **** DROP TABLE UNIQUE_TBL; CREATE TABLE UNIQUE_TBL (i int, t text, UNIQUE(i,t)); ! NOTICE: CREATE TABLE/UNIQUE will create implicit index 'unique_tbl_i_key' for table 'unique_tbl' INSERT INTO UNIQUE_TBL VALUES (1, 'one'); INSERT INTO UNIQUE_TBL VALUES (2, 'two'); INSERT INTO UNIQUE_TBL VALUES (1, 'three'); --- 353,359 ---- DROP TABLE UNIQUE_TBL; CREATE TABLE UNIQUE_TBL (i int, t text, UNIQUE(i,t)); ! NOTICE: CREATE TABLE / ADD UNIQUE will create implicit index 'unique_tbl_i_key' for table 'unique_tbl' INSERT INTO UNIQUE_TBL VALUES (1, 'one'); INSERT INTO UNIQUE_TBL VALUES (2, 'two'); INSERT INTO UNIQUE_TBL VALUES (1, 'three');