Disallow ALTER TABLE ONLY / DROP EXPRESSION
authorPeter Eisentraut <[email protected]>
Tue, 3 Nov 2020 14:14:50 +0000 (15:14 +0100)
committerPeter Eisentraut <[email protected]>
Tue, 3 Nov 2020 14:28:23 +0000 (15:28 +0100)
commitbf797a8d9768239f5e3204b013044274b2c7c24a
treece75879be917cffaf411ec7e3017caa0870b1e8c
parent2f70fdb0644c32c4154236c2b5c241bec92eac5e
Disallow ALTER TABLE ONLY / DROP EXPRESSION

The current implementation cannot handle this correctly, so just
forbid it for now.

GENERATED clauses must be attached to the column definition and cannot
be added later like DEFAULT, so if a child table has a generation
expression that the parent does not have, the child column will
necessarily be an attlocal column.  So to implement ALTER TABLE ONLY /
DROP EXPRESSION, we'd need extra code to update attislocal of the
direct child tables, somewhat similar to how DROP COLUMN does it, so
that the resulting state can be properly dumped and restored.

Discussion: https://www.postgresql.org/message-id/flat/15830.1575468847%40sss.pgh.pa.us
src/backend/commands/tablecmds.c
src/test/regress/expected/generated.out
src/test/regress/sql/generated.sql