diff --git a/src/test/regress/expected/alter_table.out b/src/test/regress/expected/alter_table.out index 5528749b953..7a0c8d9e033 100644 --- a/src/test/regress/expected/alter_table.out +++ b/src/test/regress/expected/alter_table.out @@ -1050,6 +1050,17 @@ drop table atacc1; create table atacc1 (id int not null); alter table atacc1 drop column id, add column id int, add primary key (id); drop table atacc1; +-- Likewise when an earlier subcommand drops the not-null constraint itself. +create table atacc1 (id int not null); +alter table atacc1 alter column id drop not null, add primary key (id); +drop table atacc1; +create table atacc1 (id int constraint atacc1_id_nn not null); +alter table atacc1 drop constraint atacc1_id_nn, add primary key (id); +drop table atacc1; +create table atacc1 (id int not null) partition by range (id); +create table atacc1_1 partition of atacc1 for values from (0) to (10); +alter table atacc1 alter column id drop not null, add primary key (id); +drop table atacc1; -- this combination used to have order-of-execution problems (bug #15580) create table atacc1 (a int); insert into atacc1 values(1); diff --git a/src/test/regress/sql/alter_table.sql b/src/test/regress/sql/alter_table.sql index 6e28b5539eb..0d4ba7dad26 100644 --- a/src/test/regress/sql/alter_table.sql +++ b/src/test/regress/sql/alter_table.sql @@ -786,6 +786,17 @@ drop table atacc1; create table atacc1 (id int not null); alter table atacc1 drop column id, add column id int, add primary key (id); drop table atacc1; +-- Likewise when an earlier subcommand drops the not-null constraint itself. +create table atacc1 (id int not null); +alter table atacc1 alter column id drop not null, add primary key (id); +drop table atacc1; +create table atacc1 (id int constraint atacc1_id_nn not null); +alter table atacc1 drop constraint atacc1_id_nn, add primary key (id); +drop table atacc1; +create table atacc1 (id int not null) partition by range (id); +create table atacc1_1 partition of atacc1 for values from (0) to (10); +alter table atacc1 alter column id drop not null, add primary key (id); +drop table atacc1; -- this combination used to have order-of-execution problems (bug #15580) create table atacc1 (a int);