Re: Dumping/restoring fails on inherited generated column
Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: Zhihong Yu <zyu@yugabyte.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Masahiko Sawada <sawada.mshk@gmail.com>,
Masahiko Sawada <masahiko.sawada@2ndquadrant.com>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2021-02-05T14:18:15Z
Lists: pgsql-hackers
Attachments
- v2-0001-Fix-ALTER-TABLE-INHERIT-with-generated-columns.patch (text/plain) patch v2-0001
On 2021-02-04 01:17, Zhihong Yu wrote:
> Hi,
> + if (attribute->attgenerated && !childatt->attgenerated)
> + ereport(ERROR,
> ...
> + if (attribute->attgenerated && childatt->attgenerated)
> + {
>
> Looks like for the second if statement,
> checking attribute->attgenerated should be enough (due to the check from
> the first if statement).
Thanks for taking a look. I figured the way I wrote it makes it easier
to move the code around or insert other code in the future and doesn't
make it so tightly coupled.
Anyway, I figured out how to take account of generation expressions with
different column orders. I used the same approach that we use for check
constraints. The attached patch is good to go from my perspective.
--
Peter Eisentraut
2ndQuadrant, an EDB company
https://www.2ndquadrant.com/
Commits
-
Fix ALTER TABLE / INHERIT with generated columns
- 13ff139a2384 12.7 landed
- 64190d65f299 13.3 landed
- a970edbed306 14.0 landed
-
pg_dump: Fix dumping of inherited generated columns
- 1dd6baf78802 12.6 landed
- 1d3ce0223c6a 13.2 landed
- 0bf83648a52d 14.0 landed
-
Disallow ALTER TABLE ONLY / DROP EXPRESSION
- 539775981746 13.1 landed
- bf797a8d9768 14.0 landed
-
Fix several DDL issues of generated columns versus inheritance
- 086ffddf3656 13.0 cited