Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit a6a3a27

Browse files
committed
pg_dump: Fix dump of generated columns in partitions
The previous fix for dumping of inherited generated columns (0bf8364) must not be applied to partitions, since, unlike normal inherited tables, they are always dumped separately and reattached. Reported-by: Santosh Udupi <email@hitha.net> Discussion: https://www.postgresql.org/message-id/flat/CACLRvHZ4a-%2BSM_159%2BtcrHdEqxFrG%3DW4gwTRnwf7Oj0UNj5R2A%40mail.gmail.com
1 parent 64190d6 commit a6a3a27

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/bin/pg_dump/common.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -444,9 +444,11 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables)
444444
* - Detect child columns that have a generation expression when their parents
445445
* also have one. Generation expressions are always inherited, so there is
446446
* no need to set them again in child tables, and there is no syntax for it
447-
* either. (Exception: In binary upgrade mode we dump them because
448-
* inherited tables are recreated standalone first and then reattached to
449-
* the parent.)
447+
* either. Exceptions: If it's a partition or we are in binary upgrade
448+
* mode, we dump them because in those cases inherited tables are recreated
449+
* standalone first and then reattached to the parent. (See also the logic
450+
* in dumpTableSchema().) In that situation, the generation expressions
451+
* must match the parent, enforced by ALTER TABLE.
450452
*
451453
* modifies tblinfo
452454
*/
@@ -549,7 +551,7 @@ flagInhAttrs(DumpOptions *dopt, TableInfo *tblinfo, int numTables)
549551
}
550552

551553
/* Remove generation expression from child */
552-
if (foundGenerated && !dopt->binary_upgrade)
554+
if (foundGenerated && !tbinfo->ispartition && !dopt->binary_upgrade)
553555
tbinfo->attrdefs[j] = NULL;
554556
}
555557
}

0 commit comments

Comments
 (0)