diff options
| author | Robert Haas | 2011-01-21 03:44:10 +0000 |
|---|---|---|
| committer | Robert Haas | 2011-01-21 03:44:10 +0000 |
| commit | 8ceb24568054232696dddc1166a8563bc78c900a (patch) | |
| tree | a9921588da9066933ddf723e79345471909de5e5 /src/test | |
| parent | 14b9f69cb2077c65a09df78d167d45c35b1d7973 (diff) | |
Make ALTER TABLE revalidate uniqueness and exclusion constraints.
Failure to do so can lead to constraint violations. This was broken by
commit 1ddc2703a936d03953657f43345460b9242bbed1 on 2010-02-07, so
back-patch to 9.0.
Noah Misch. Regression test by me.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/regress/expected/alter_table.out | 4 | ||||
| -rw-r--r-- | src/test/regress/sql/alter_table.sql | 2 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/test/regress/expected/alter_table.out b/src/test/regress/expected/alter_table.out index 3d126bbf308..3280065f75b 100644 --- a/src/test/regress/expected/alter_table.out +++ b/src/test/regress/expected/alter_table.out @@ -413,6 +413,10 @@ 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" +-- try to create duplicates via alter table using - should fail +alter table atacc1 alter column test type integer using 0; +ERROR: could not create unique index "atacc_test1" +DETAIL: Key (test)=(0) is duplicated. drop table atacc1; -- let's do one where the unique constraint fails when added create table atacc1 ( test int ); diff --git a/src/test/regress/sql/alter_table.sql b/src/test/regress/sql/alter_table.sql index 4895768d7fe..cfbfbb6b438 100644 --- a/src/test/regress/sql/alter_table.sql +++ b/src/test/regress/sql/alter_table.sql @@ -419,6 +419,8 @@ insert into atacc1 (test) values (2); insert into atacc1 (test) values (4); -- try adding a unique oid constraint alter table atacc1 add constraint atacc_oid1 unique(oid); +-- try to create duplicates via alter table using - should fail +alter table atacc1 alter column test type integer using 0; drop table atacc1; -- let's do one where the unique constraint fails when added |
