diff options
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/regress/expected/alter_table.out | 40 | ||||
-rw-r--r-- | src/test/regress/sql/alter_table.sql | 17 |
2 files changed, 57 insertions, 0 deletions
diff --git a/src/test/regress/expected/alter_table.out b/src/test/regress/expected/alter_table.out index 78bc4ffde62..3297efbd041 100644 --- a/src/test/regress/expected/alter_table.out +++ b/src/test/regress/expected/alter_table.out @@ -1934,6 +1934,46 @@ select * from anothertab; (3 rows) drop table anothertab; +-- Test alter table column type with constraint indexes (cf. bug #15835) +create table anothertab(f1 int primary key, f2 int unique, f3 int, f4 int); +alter table anothertab + add exclude using btree (f3 with =); +alter table anothertab + add exclude using btree (f4 with =) where (f4 is not null); +\d anothertab + Table "public.anothertab" + Column | Type | Modifiers +--------+---------+----------- + f1 | integer | not null + f2 | integer | + f3 | integer | + f4 | integer | +Indexes: + "anothertab_pkey" PRIMARY KEY, btree (f1) + "anothertab_f2_key" UNIQUE CONSTRAINT, btree (f2) + "anothertab_f3_excl" EXCLUDE USING btree (f3 WITH =) + "anothertab_f4_excl" EXCLUDE USING btree (f4 WITH =) WHERE (f4 IS NOT NULL) + +alter table anothertab alter column f1 type bigint; +alter table anothertab + alter column f2 type bigint, + alter column f3 type bigint, + alter column f4 type bigint; +\d anothertab + Table "public.anothertab" + Column | Type | Modifiers +--------+--------+----------- + f1 | bigint | not null + f2 | bigint | + f3 | bigint | + f4 | bigint | +Indexes: + "anothertab_pkey" PRIMARY KEY, btree (f1) + "anothertab_f2_key" UNIQUE CONSTRAINT, btree (f2) + "anothertab_f3_excl" EXCLUDE USING btree (f3 WITH =) + "anothertab_f4_excl" EXCLUDE USING btree (f4 WITH =) WHERE (f4 IS NOT NULL) + +drop table anothertab; create table another (f1 int, f2 text); insert into another values(1, 'one'); insert into another values(2, 'two'); diff --git a/src/test/regress/sql/alter_table.sql b/src/test/regress/sql/alter_table.sql index f9f952eb87d..16aedd08dbb 100644 --- a/src/test/regress/sql/alter_table.sql +++ b/src/test/regress/sql/alter_table.sql @@ -1307,6 +1307,23 @@ select * from anothertab; drop table anothertab; +-- Test alter table column type with constraint indexes (cf. bug #15835) +create table anothertab(f1 int primary key, f2 int unique, f3 int, f4 int); +alter table anothertab + add exclude using btree (f3 with =); +alter table anothertab + add exclude using btree (f4 with =) where (f4 is not null); + +\d anothertab +alter table anothertab alter column f1 type bigint; +alter table anothertab + alter column f2 type bigint, + alter column f3 type bigint, + alter column f4 type bigint; +\d anothertab + +drop table anothertab; + create table another (f1 int, f2 text); insert into another values(1, 'one'); |