Fix ALTER TABLE DROP EXPRESSION with inheritance hierarchy
jian he <jian.universality@gmail.com>
From: jian he <jian.universality@gmail.com>
To: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2025-08-24T09:05:01Z
Lists: pgsql-hackers
Attachments
- v1-0001-Fix-ALTER-TABLE-DROP-EXPRESSION-with-inheritance-hierarch.patch (text/x-patch) patch v1-0001
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.