Commit feb270d1 authored by Peter Eisentraut's avatar Peter Eisentraut

pg_dump: Fix dump of generated columns in partitions

The previous fix for dumping of inherited generated columns
(0bf83648) must not be applied to
partitions, since, unlike normal inherited tables, they are always
dumped separately and reattached.
Reported-by: default avatarSantosh Udupi <email@hitha.net>
Discussion: https://www.postgresql.org/message-id/flat/CACLRvHZ4a-%2BSM_159%2BtcrHdEqxFrG%3DW4gwTRnwf7Oj0UNj5R2A%40mail.gmail.com
parent a970edbe
...@@ -480,9 +480,11 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) ...@@ -480,9 +480,11 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables)
* - Detect child columns that have a generation expression when their parents * - Detect child columns that have a generation expression when their parents
* also have one. Generation expressions are always inherited, so there is * 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 * 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 * either. Exceptions: If it's a partition or we are in binary upgrade
* inherited tables are recreated standalone first and then reattached to * mode, we dump them because in those cases inherited tables are recreated
* the parent.) * 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 * modifies tblinfo
*/ */
...@@ -585,7 +587,7 @@ flagInhAttrs(DumpOptions *dopt, TableInfo *tblinfo, int numTables) ...@@ -585,7 +587,7 @@ flagInhAttrs(DumpOptions *dopt, TableInfo *tblinfo, int numTables)
} }
/* Remove generation expression from child */ /* Remove generation expression from child */
if (foundGenerated && !dopt->binary_upgrade) if (foundGenerated && !tbinfo->ispartition && !dopt->binary_upgrade)
tbinfo->attrdefs[j] = NULL; tbinfo->attrdefs[j] = NULL;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment