From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Dumping/restoring fails on inherited generated column
Date: Mon, 3 Feb 2020 19:58:43 +0100
Message-ID: <d6ebcc2e-3e6f-6915-6616-70ef665aed66@2ndquadrant.com> (raw)
In-Reply-To: <31905.1575491779@sss.pgh.pa.us>
References: <15830.1575468847@sss.pgh.pa.us>
<fd559544-274c-f514-d8bf-358d2c539455@2ndquadrant.com>
<31905.1575491779@sss.pgh.pa.us>
On 2019-12-04 21:36, Tom Lane wrote:
> 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?
Right. New patch using that approach attached. (Could use more
extensive comments.)
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Attachments:v2-0001-Fix-dumping-of-inherited-generated-columns.patch (text/plain, 1004B) download
From eeeab95adcaa298851abd3fd44d8646510e7aed2 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter@eisentraut.org>
Date: Mon, 3 Feb 2020 19:56:34 +0100
Subject: [PATCH v2] Fix dumping of inherited generated columns
---
src/bin/pg_dump/pg_dump.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.cindex 33e58fa287..c9938323b1 100644--- a/src/bin/pg_dump/pg_dump.c+++ b/src/bin/pg_dump/pg_dump.c@@ -8492,6 +8492,13 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int numTables)
if (tbinfo->attisdropped[adnum - 1])
continue;
+ /*+ * ignore generated columns on child tables unless they have a+ * local definition+ */+ if (tbinfo->attgenerated[adnum - 1] && !tbinfo->attislocal[adnum - 1])+ continue;+
attrdefs[j].dobj.objType = DO_ATTRDEF;
attrdefs[j].dobj.catId.tableoid = atooid(PQgetvalue(res, j, 0));
attrdefs[j].dobj.catId.oid = atooid(PQgetvalue(res, j, 1));
--
2.25.0
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: peter.eisentraut@2ndquadrant.com, tgl@sss.pgh.pa.us, pgsql-hackers@lists.postgresql.org
Subject: Re: Dumping/restoring fails on inherited generated column
In-Reply-To: <d6ebcc2e-3e6f-6915-6616-70ef665aed66@2ndquadrant.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox