Hi Nitin,

> A gentle ping on v3. It still applies to master and CFBot is green;
> the only change from v2 is the rename you suggested. If you have
> further comments, please let me know. If v3 looks fine, would you be
> willing to mark it Ready for Committer on the CommitFest entry [1]?

Thanks for the ping, and sorry for the delay. I looked at v3 again.
The new name reads well, and it applies cleanly to current master.

A commit that went in after my v2 review adds one thing to do,
though. Since 0b0f5c5af11 ("Forbid ALTERing column type by default
when other objects depend on it", back-patched to 14), SET
EXPRESSION on a STORED column fails if views, function bodies and
the like use the table's row type. pg_dump restores such objects
before the attrdefs, so the child's SET EXPRESSION fails when
restoring a v3 dump:

  CREATE TABLE p (x int, g int GENERATED ALWAYS AS (x * 2) STORED);
  CREATE TABLE c () INHERITS (p);
  ALTER TABLE ONLY c ALTER COLUMN g SET EXPRESSION AS (x * 3);
  INSERT INTO c VALUES (1);
  CREATE VIEW v AS SELECT ROW(1, 3)::c AS r;

  ERROR:  cannot alter table "c" because rule _RETURN on view public.v uses
its row type

The same happens with a BEGIN ATOMIC function (function public.f()
uses its row type) or a column of that type in another table (column
"audit.old_row" uses its row type). The restored c.g stays (x * 2),
and with -1 the whole restore aborts.

The SET EXPRESSION defect that drops inherited CHECK and NOT NULL
constraints I still see as I said in my v2 review: a backend problem
separate from this patch.

Once this is fixed, I will mark it Ready for Committer.

Best regards,
Henson

Reply via email to