The following bug has been logged on the website:
Bug reference: 16700
Logged by: Daniel Vérité
Email address: daniel@manitou-mail.org
PostgreSQL version: 9.6.18
Operating system: Linux
Description:
Hi,
When dropping a column in a parent table, the change is propagated to child
tables.
But when a child has been moved out of the hierarchy and then back into
it,
this propagation appears to no longer work for that child table.
Below is a reproducer I've tried with both the current devel version and 9.6
(9.6 is the version I'm having the issue with in production). The result is
the same.
DROP TABLE IF EXISTS parent_tbl CASCADE;
CREATE TABLE parent_tbl(f1 int, f2 int, f3 int);
CREATE TABLE child1_tbl() INHERITS(parent_tbl);
CREATE TABLE child2_tbl() INHERITS(parent_tbl);
CREATE TABLE child3_tbl() INHERITS(parent_tbl);
ALTER TABLE child2_tbl NO INHERIT parent_tbl;
ALTER TABLE child2_tbl INHERIT parent_tbl;
ALTER TABLE parent_tbl DROP COLUMN f2;
\d child*_tbl
Table "public.child1_tbl"
Column | Type | Collation | Nullable | Default
--------+---------+-----------+----------+---------
f1 | integer | | |
f3 | integer | | |
Inherits: parent_tbl
Table "public.child2_tbl"
Column | Type | Collation | Nullable | Default
--------+---------+-----------+----------+---------
f1 | integer | | |
f2 | integer | | |
f3 | integer | | |
Inherits: parent_tbl
Table "public.child3_tbl"
Column | Type | Collation | Nullable | Default
--------+---------+-----------+----------+---------
f1 | integer | | |
f3 | integer | | |
Inherits: parent_tbl
It's surprising that dropping the parent_tbl.f2 column does not cascade into
child2_tbl, even though child2_tbl is a member of the hierarchy.
Is it a bug?