diff options
author | Peter Eisentraut <peter@eisentraut.org> | 2021-05-04 14:03:54 +0200 |
---|---|---|
committer | Peter Eisentraut <peter@eisentraut.org> | 2021-05-04 14:18:23 +0200 |
commit | a6a3a274abd1368a0104fe2cfc7227c9a7e95970 (patch) | |
tree | 6c9a4bfe85a0d85fe082443f7cd55e526d949790 /src | |
parent | 64190d65f2995203df401738b77adc5ebd4d2fce (diff) | |
download | postgresql-a6a3a274abd1368a0104fe2cfc7227c9a7e95970.tar.gz postgresql-a6a3a274abd1368a0104fe2cfc7227c9a7e95970.zip |
pg_dump: Fix dump of generated columns in partitions
The previous fix for dumping of inherited generated columns
(0bf83648a52df96f7c8677edbbdf141bfa0cf32b) 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
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/pg_dump/common.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 3f3a24493e7..c9f7999d87e 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -444,9 +444,11 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) * - Detect child columns that have a generation expression when their parents * also have one. Generation expressions are always inherited, so there is * no need to set them again in child tables, and there is no syntax for it - * either. (Exception: In binary upgrade mode we dump them because - * inherited tables are recreated standalone first and then reattached to - * the parent.) + * either. Exceptions: If it's a partition or we are in binary upgrade + * mode, we dump them because in those cases inherited tables are recreated + * standalone first and then reattached to the parent. (See also the logic + * in dumpTableSchema().) In that situation, the generation expressions + * must match the parent, enforced by ALTER TABLE. * * modifies tblinfo */ @@ -549,7 +551,7 @@ flagInhAttrs(DumpOptions *dopt, TableInfo *tblinfo, int numTables) } /* Remove generation expression from child */ - if (foundGenerated && !dopt->binary_upgrade) + if (foundGenerated && !tbinfo->ispartition && !dopt->binary_upgrade) tbinfo->attrdefs[j] = NULL; } } |