Commit 434077c4 authored by Bruce Momjian's avatar Bruce Momjian

Remove "ADD" from TABLE / ADD UNIQUE-PRIMARY error message because the

same code is called for both creation and alter.  Not worth worrying
about.
parent 8ee7c19e
......@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.207 2001/11/02 20:23:02 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.208 2001/11/04 02:41:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -1239,7 +1239,7 @@ transformIndexConstraints(ParseState *pstate, CreateStmtContext *cxt)
cxt->stmtType);
elog(NOTICE, "%s / %s will create implicit index '%s' for table '%s'",
cxt->stmtType, (index->primary ? "ADD PRIMARY KEY" : "ADD UNIQUE"),
cxt->stmtType, (index->primary ? "PRIMARY KEY" : "UNIQUE"),
index->idxname, cxt->relname);
}
}
......
......@@ -271,10 +271,10 @@ SELECT unique1 FROM tenk1 WHERE unique1 < 5;
-- FOREIGN KEY CONSTRAINT adding TEST
CREATE TABLE tmp2 (a int primary key);
NOTICE: CREATE TABLE / ADD PRIMARY KEY will create implicit index 'tmp2_pkey' for table 'tmp2'
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'
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);
......@@ -317,7 +317,7 @@ DROP TABLE tmp2;
-- 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 / ADD PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
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,7 +345,7 @@ NOTICE: DROP TABLE implicitly drops referential integrity trigger from table "f
DROP TABLE fktable;
CREATE TEMP TABLE PKTABLE (ptest1 int, ptest2 text,
PRIMARY KEY(ptest1, ptest2));
NOTICE: CREATE TABLE / ADD PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
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;
......@@ -452,7 +452,7 @@ drop table atacc1;
create table atacc1 ( test int );
-- add a unique constraint
alter table atacc1 add constraint atacc_test1 unique (test);
NOTICE: ALTER TABLE / ADD UNIQUE will create implicit index 'atacc_test1' for table 'atacc1'
NOTICE: ALTER TABLE / UNIQUE will create implicit index 'atacc_test1' for table 'atacc1'
-- insert first value
insert into atacc1 (test) values (2);
-- should fail
......@@ -462,7 +462,7 @@ ERROR: Cannot insert a duplicate key into unique index atacc_test1
insert into atacc1 (test) values (4);
-- try adding a unique oid constraint
alter table atacc1 add constraint atacc_oid1 unique(oid);
NOTICE: ALTER TABLE / ADD UNIQUE will create implicit index 'atacc_oid1' for table 'atacc1'
NOTICE: ALTER TABLE / UNIQUE will create implicit index 'atacc_oid1' for table 'atacc1'
drop table atacc1;
-- let's do one where the unique constraint fails when added
create table atacc1 ( test int );
......@@ -471,7 +471,7 @@ insert into atacc1 (test) values (2);
insert into atacc1 (test) values (2);
-- add a unique constraint (fails)
alter table atacc1 add constraint atacc_test1 unique (test);
NOTICE: ALTER TABLE / ADD UNIQUE will create implicit index 'atacc_test1' for table 'atacc1'
NOTICE: ALTER TABLE / UNIQUE will create implicit index 'atacc_test1' for table 'atacc1'
ERROR: Cannot create unique index. Table contains non-unique values
insert into atacc1 (test) values (3);
drop table atacc1;
......@@ -486,7 +486,7 @@ drop table atacc1;
create table atacc1 ( test int, test2 int);
-- add a unique constraint
alter table atacc1 add constraint atacc_test1 unique (test, test2);
NOTICE: ALTER TABLE / ADD UNIQUE will create implicit index 'atacc_test1' for table 'atacc1'
NOTICE: ALTER TABLE / UNIQUE will create implicit index 'atacc_test1' for table 'atacc1'
-- insert initial value
insert into atacc1 (test,test2) values (4,4);
-- should fail
......@@ -499,9 +499,9 @@ insert into atacc1 (test,test2) values (5,5);
drop table atacc1;
-- lets do some naming tests
create table atacc1 (test int, test2 int, unique(test));
NOTICE: CREATE TABLE / ADD UNIQUE will create implicit index 'atacc1_test_key' for table 'atacc1'
NOTICE: CREATE TABLE / UNIQUE will create implicit index 'atacc1_test_key' for table 'atacc1'
alter table atacc1 add unique (test2);
NOTICE: ALTER TABLE / ADD UNIQUE will create implicit index 'atacc1_test2_key' for table 'atacc1'
NOTICE: ALTER TABLE / UNIQUE will create implicit index 'atacc1_test2_key' for table 'atacc1'
-- should fail for @@ second one @@
insert into atacc1 (test2, test) values (3, 3);
insert into atacc1 (test2, test) values (2, 3);
......
......@@ -137,7 +137,7 @@ INSERT INTO iportaltest (i, d, p)
---
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'
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);
......
This diff is collapsed.
......@@ -286,7 +286,7 @@ SELECT * FROM COPY_TBL;
-- Primary keys
--
CREATE TABLE PRIMARY_TBL (i int PRIMARY KEY, t text);
NOTICE: CREATE TABLE / ADD PRIMARY KEY will create implicit index 'primary_tbl_pkey' for table 'primary_tbl'
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,7 +307,7 @@ SELECT '' AS four, * FROM PRIMARY_TBL;
DROP TABLE PRIMARY_TBL;
CREATE TABLE PRIMARY_TBL (i int, t text,
PRIMARY KEY(i,t));
NOTICE: CREATE TABLE / ADD PRIMARY KEY will create implicit index 'primary_tbl_pkey' for table 'primary_tbl'
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,7 +330,7 @@ DROP TABLE PRIMARY_TBL;
-- 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'
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,7 +353,7 @@ SELECT '' AS five, * FROM UNIQUE_TBL;
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'
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');
......
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