v1-0001-Fix-dumping-of-inherited-generated-columns.patch

text/plain

Filename: v1-0001-Fix-dumping-of-inherited-generated-columns.patch
Type: text/plain
Part: 0
Message: Re: Dumping/restoring fails on inherited generated column

Patch

Format: format-patch
Series: patch v1-0001
Subject: Fix dumping of inherited generated columns
File+
src/bin/pg_dump/pg_dump.c 5 0
From 0ef24c98edf468ebe906c5b04e3ddf9e53bda02f Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter@eisentraut.org>
Date: Wed, 4 Dec 2019 21:14:19 +0100
Subject: [PATCH v1] Fix dumping of inherited generated columns

---
 src/bin/pg_dump/pg_dump.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 33e58fa287..87b3c5b09c 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -8515,6 +8515,11 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int numTables)
 				{
 					attrdefs[j].separate = true;
 				}
+				else if (tbinfo->attgenerated[adnum - 1])
+				{
+					/* generated columns only go with the root table */
+					attrdefs[j].separate = false;
+				}
 				else if (!shouldPrintColumn(dopt, tbinfo, adnum - 1))
 				{
 					/* column will be suppressed, print default separately */
-- 
2.24.0