Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit434077c

Browse files
committed
Remove "ADD" from TABLE / ADD UNIQUE-PRIMARY error message because the
same code is called for both creation and alter. Not worth worryingabout.
1 parent8ee7c19 commit434077c

File tree

5 files changed

+42
-42
lines changed

5 files changed

+42
-42
lines changed

‎src/backend/parser/analyze.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
*$Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.207 2001/11/02 20:23:02 tgl Exp $
9+
*$Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.208 2001/11/04 02:41:09 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -1239,7 +1239,7 @@ transformIndexConstraints(ParseState *pstate, CreateStmtContext *cxt)
12391239
cxt->stmtType);
12401240

12411241
elog(NOTICE,"%s / %s will create implicit index '%s' for table '%s'",
1242-
cxt->stmtType, (index->primary ?"ADDPRIMARY KEY" :"ADDUNIQUE"),
1242+
cxt->stmtType, (index->primary ?"PRIMARY KEY" :"UNIQUE"),
12431243
index->idxname,cxt->relname);
12441244
}
12451245
}

‎src/test/regress/expected/alter_table.out

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -271,10 +271,10 @@ SELECT unique1 FROM tenk1 WHERE unique1 < 5;
271271

272272
-- FOREIGN KEY CONSTRAINT adding TEST
273273
CREATE TABLE tmp2 (a int primary key);
274-
NOTICE: CREATE TABLE /ADDPRIMARY KEY will create implicit index 'tmp2_pkey' for table 'tmp2'
274+
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'tmp2_pkey' for table 'tmp2'
275275
CREATE TABLE tmp3 (a int, b int);
276276
CREATE TABLE tmp4 (a int, b int, unique(a,b));
277-
NOTICE: CREATE TABLE /ADDUNIQUE will create implicit index 'tmp4_a_key' for table 'tmp4'
277+
NOTICE: CREATE TABLE / UNIQUE will create implicit index 'tmp4_a_key' for table 'tmp4'
278278
CREATE TABLE tmp5 (a int, b int);
279279
-- Insert rows into tmp2 (pktable)
280280
INSERT INTO tmp2 values (1);
@@ -317,7 +317,7 @@ DROP TABLE tmp2;
317317
-- Note: these tables are TEMP to avoid name conflicts when this test
318318
-- is run in parallel with foreign_key.sql.
319319
CREATE TEMP TABLE PKTABLE (ptest1 int PRIMARY KEY);
320-
NOTICE: CREATE TABLE /ADDPRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
320+
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
321321
CREATE TEMP TABLE FKTABLE (ftest1 text);
322322
-- This next should fail, because text=int does not exist
323323
ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1) references pktable;
@@ -345,7 +345,7 @@ NOTICE: DROP TABLE implicitly drops referential integrity trigger from table "f
345345
DROP TABLE fktable;
346346
CREATE TEMP TABLE PKTABLE (ptest1 int, ptest2 text,
347347
PRIMARY KEY(ptest1, ptest2));
348-
NOTICE: CREATE TABLE /ADDPRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
348+
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
349349
-- This should fail, because we just chose really odd types
350350
CREATE TEMP TABLE FKTABLE (ftest1 cidr, ftest2 datetime);
351351
ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1, ftest2) references pktable;
@@ -452,7 +452,7 @@ drop table atacc1;
452452
create table atacc1 ( test int );
453453
-- add a unique constraint
454454
alter table atacc1 add constraint atacc_test1 unique (test);
455-
NOTICE: ALTER TABLE /ADDUNIQUE will create implicit index 'atacc_test1' for table 'atacc1'
455+
NOTICE: ALTER TABLE / UNIQUE will create implicit index 'atacc_test1' for table 'atacc1'
456456
-- insert first value
457457
insert into atacc1 (test) values (2);
458458
-- should fail
@@ -462,7 +462,7 @@ ERROR: Cannot insert a duplicate key into unique index atacc_test1
462462
insert into atacc1 (test) values (4);
463463
-- try adding a unique oid constraint
464464
alter table atacc1 add constraint atacc_oid1 unique(oid);
465-
NOTICE: ALTER TABLE /ADDUNIQUE will create implicit index 'atacc_oid1' for table 'atacc1'
465+
NOTICE: ALTER TABLE / UNIQUE will create implicit index 'atacc_oid1' for table 'atacc1'
466466
drop table atacc1;
467467
-- let's do one where the unique constraint fails when added
468468
create table atacc1 ( test int );
@@ -471,7 +471,7 @@ insert into atacc1 (test) values (2);
471471
insert into atacc1 (test) values (2);
472472
-- add a unique constraint (fails)
473473
alter table atacc1 add constraint atacc_test1 unique (test);
474-
NOTICE: ALTER TABLE /ADDUNIQUE will create implicit index 'atacc_test1' for table 'atacc1'
474+
NOTICE: ALTER TABLE / UNIQUE will create implicit index 'atacc_test1' for table 'atacc1'
475475
ERROR: Cannot create unique index. Table contains non-unique values
476476
insert into atacc1 (test) values (3);
477477
drop table atacc1;
@@ -486,7 +486,7 @@ drop table atacc1;
486486
create table atacc1 ( test int, test2 int);
487487
-- add a unique constraint
488488
alter table atacc1 add constraint atacc_test1 unique (test, test2);
489-
NOTICE: ALTER TABLE /ADDUNIQUE will create implicit index 'atacc_test1' for table 'atacc1'
489+
NOTICE: ALTER TABLE / UNIQUE will create implicit index 'atacc_test1' for table 'atacc1'
490490
-- insert initial value
491491
insert into atacc1 (test,test2) values (4,4);
492492
-- should fail
@@ -499,9 +499,9 @@ insert into atacc1 (test,test2) values (5,5);
499499
drop table atacc1;
500500
-- lets do some naming tests
501501
create table atacc1 (test int, test2 int, unique(test));
502-
NOTICE: CREATE TABLE /ADDUNIQUE will create implicit index 'atacc1_test_key' for table 'atacc1'
502+
NOTICE: CREATE TABLE / UNIQUE will create implicit index 'atacc1_test_key' for table 'atacc1'
503503
alter table atacc1 add unique (test2);
504-
NOTICE: ALTER TABLE /ADDUNIQUE will create implicit index 'atacc1_test2_key' for table 'atacc1'
504+
NOTICE: ALTER TABLE / UNIQUE will create implicit index 'atacc1_test2_key' for table 'atacc1'
505505
-- should fail for @@ second one @@
506506
insert into atacc1 (test2, test) values (3, 3);
507507
insert into atacc1 (test2, test) values (2, 3);

‎src/test/regress/expected/create_misc.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ INSERT INTO iportaltest (i, d, p)
137137
---
138138
CREATE TABLE serialTest (f1 text, f2 serial);
139139
NOTICE: CREATE TABLE will create implicit sequence 'serialtest_f2_seq' for SERIAL column 'serialtest.f2'
140-
NOTICE: CREATE TABLE /ADDUNIQUE will create implicit index 'serialtest_f2_key' for table 'serialtest'
140+
NOTICE: CREATE TABLE / UNIQUE will create implicit index 'serialtest_f2_key' for table 'serialtest'
141141
INSERT INTO serialTest VALUES ('foo');
142142
INSERT INTO serialTest VALUES ('bar');
143143
INSERT INTO serialTest VALUES ('force', 100);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp