Hi,

I looked at this as was mentioned on the bug fix for #19773 [1]. The
pg_dump fix for that bug restores a child's differing generation
expression with ALTER TABLE ONLY ... SET EXPRESSION. With either of
the v4 patches here, that restore fails when the child has a
constraint on the column, e.g.:

CREATE TABLE p (v int, g int GENERATED ALWAYS AS (v * 2) STORED,
                  CONSTRAINT p_g_pos CHECK (g > 0));
  CREATE TABLE c () INHERITS (p);
  ALTER TABLE ONLY c ALTER COLUMN g SET EXPRESSION AS (v * 5);
  ERROR:  ALTER TABLE ONLY ... SET EXPRESSION is not supported for
generated columns with dependent objects on a parent table

On master, the same ALTER succeeds but c loses the inherited CHECK.

Could the re-validate approach also cover inheritance children and
ONLY, so that such dumps restore correctly?

[1] 
https://www.postgresql.org/message-id/flat/CAH5HC97y7PFE6rJh8kVDUszPxGQE030nZvyHu%3DwZT7FBkOV3qA%40mail.gmail.com

Thanks & Regards,
Nitin Motiani
Google


Reply via email to