Fix ALTER TABLE DROP EXPRESSION with inheritance hierarchy - Mailing list pgsql-hackers

From jian he
Subject Fix ALTER TABLE DROP EXPRESSION with inheritance hierarchy
Date
Msg-id CACJufxEW9L279n=fpUg+qrXYP6g4oh_RLOTHVVphkWDVqaNGDw@mail.gmail.com
Whole thread Raw
List pgsql-hackers
hi.

--this ALTER COLUMN  DROP EXPRESSION work as expected
DROP TABLE IF EXISTS parent cascade;
CREATE TABLE parent (a int, d INT GENERATED ALWAYS AS (11) STORED);
CREATE TABLE child () INHERITS (parent);
ALTER TABLE parent ALTER COLUMN d DROP EXPRESSION;


----- the below (ALTER COLUMN  DROP EXPRESSION) should also work.
-----
DROP TABLE IF EXISTS parent cascade;
CREATE TABLE parent (a int, d INT GENERATED ALWAYS AS (11) STORED);
CREATE TABLE child () INHERITS (parent);
CREATE TABLE grandchild () INHERITS (child);
ALTER TABLE parent ALTER COLUMN d DROP EXPRESSION;

but currently it will generated error:
ERROR:  0A000: ALTER TABLE / DROP EXPRESSION must be applied to child tables too
LOCATION:  ATPrepDropExpression, tablecmds.c:8734

The attached patch fixes this potential issue.

Attachment

pgsql-hackers by date:

Previous
From: Noah Misch
Date:
Subject: Re: Non-text mode for pg_dumpall
Next
From: Srinath Reddy Sadipiralla
Date:
Subject: Re: Potential problem in commit f777d773878 and 4f7f7b03758