BUG #16700: Child table dependency loss after moving out of and back into the inheritance tree

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: daniel(at)manitou-mail(dot)org
Subject: BUG #16700: Child table dependency loss after moving out of and back into the inheritance tree
Date: 2020-11-04 11:09:56
Message-ID: 16700-39027e4b536105de@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 16700
Logged by: Daniel Vérité
Email address: daniel(at)manitou-mail(dot)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?

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Alvaro Herrera 2020-11-04 13:49:31 Re: BUG #16643: PG13 - Logical replication - initial startup never finishes and gets stuck in startup loop
Previous Message Amit Kapila 2020-11-04 05:28:57 Re: BUG #16643: PG13 - Logical replication - initial startup never finishes and gets stuck in startup loop