Re: Dumping/restoring fails on inherited generated column
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: pgsql-hackers@lists.postgresql.org
Date: 2019-12-04T20:36:19Z
Lists: pgsql-hackers
Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes: > On 2019-12-04 15:14, Tom Lane wrote: >> It looks like gtest1_1 inherits column "b" from gtest1, so possibly >> pg_dump is just confused about the combination of inheritance and >> generated columns. > Yeah, there was some stuff about the "separate" dumping of defaults that > I apparently forgot to address. The attached patch fixes it. I'll see > about adding a test case for it, too. I don't think this is right. It will probably misbehave if the "generated" expression has any interesting dependencies: 1. You didn't duplicate the behavior of the existing separate=false case, where it adds a dependency to try to force the default's dependencies to exist before the table is created. 2. If that dependency turns out to create a dependency loop, the later code will break the loop by setting separate=true anyway. Then what? I also find it improbable that overriding the !shouldPrintColumn test is really the right thing. That test is what distinguishes the is-a-parent-table from the is-a-child-table cases, and the core of the issue here seems to be that we need to treat those differently. I wonder if the right fix is to not generate a DO_ATTRDEF object at all for generated columns in child tables. Am I right in guessing that we propagate generated-ness to child tables automatically? regards, tom lane
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