aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/backend/commands/tablecmds.c2
-rw-r--r--src/test/regress/expected/inherit.out15
-rw-r--r--src/test/regress/sql/inherit.sql3
3 files changed, 18 insertions, 2 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index f47b82dbcf3..11fcb51a165 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -7533,6 +7533,8 @@ ATExecAddColumn(List **wqueue, AlteredTableInfo *tab, Relation rel,
if (!missingIsNull)
{
StoreAttrMissingVal(rel, attribute->attnum, missingval);
+ /* Make the additional catalog change visible */
+ CommandCounterIncrement();
has_missing = true;
}
FreeExecutorState(estate);
diff --git a/src/test/regress/expected/inherit.out b/src/test/regress/expected/inherit.out
index c01e9d5244f..2a8bfba768e 100644
--- a/src/test/regress/expected/inherit.out
+++ b/src/test/regress/expected/inherit.out
@@ -1096,17 +1096,30 @@ CREATE TABLE inhta ();
CREATE TABLE inhtb () INHERITS (inhta);
CREATE TABLE inhtc () INHERITS (inhtb);
CREATE TABLE inhtd () INHERITS (inhta, inhtb, inhtc);
-ALTER TABLE inhta ADD COLUMN i int;
+ALTER TABLE inhta ADD COLUMN i int, ADD COLUMN j bigint DEFAULT 1;
NOTICE: merging definition of column "i" for child "inhtd"
NOTICE: merging definition of column "i" for child "inhtd"
+NOTICE: merging definition of column "j" for child "inhtd"
+NOTICE: merging definition of column "j" for child "inhtd"
\d+ inhta
Table "public.inhta"
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
--------+---------+-----------+----------+---------+---------+--------------+-------------
i | integer | | | | plain | |
+ j | bigint | | | 1 | plain | |
Child tables: inhtb,
inhtd
+\d+ inhtd
+ Table "public.inhtd"
+ Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
+--------+---------+-----------+----------+---------+---------+--------------+-------------
+ i | integer | | | | plain | |
+ j | bigint | | | 1 | plain | |
+Inherits: inhta,
+ inhtb,
+ inhtc
+
DROP TABLE inhta, inhtb, inhtc, inhtd;
-- Test for renaming in diamond inheritance
CREATE TABLE inht2 (x int) INHERITS (inht1);
diff --git a/src/test/regress/sql/inherit.sql b/src/test/regress/sql/inherit.sql
index 9b4bd4606f9..699e8ac09c8 100644
--- a/src/test/regress/sql/inherit.sql
+++ b/src/test/regress/sql/inherit.sql
@@ -380,8 +380,9 @@ CREATE TABLE inhta ();
CREATE TABLE inhtb () INHERITS (inhta);
CREATE TABLE inhtc () INHERITS (inhtb);
CREATE TABLE inhtd () INHERITS (inhta, inhtb, inhtc);
-ALTER TABLE inhta ADD COLUMN i int;
+ALTER TABLE inhta ADD COLUMN i int, ADD COLUMN j bigint DEFAULT 1;
\d+ inhta
+\d+ inhtd
DROP TABLE inhta, inhtb, inhtc, inhtd;
-- Test for renaming in diamond inheritance