pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
To: Santosh Udupi <email@hitha.net>
Cc: Adrian Klaver <adrian.klaver@aklaver.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: pg_restore - generated column - not populating
Date: Mon, 26 Apr 2021 15:40:53 +0200
Message-ID: <a9d2893c-bb4a-aadf-c02d-535e752ab2b7@enterprisedb.com> (raw)
In-Reply-To: <4007188.1614128586@sss.pgh.pa.us>
References: <CACLRvHZ4a-+SM_159+tcrHdEqxFrG=W4gwTRnwf7Oj0UNj5R2A@mail.gmail.com>
	<9881df8c-f88e-977e-f222-adb04ba1ec80@aklaver.com>
	<CACLRvHY+bD8R-=BWP6U5fBNu0qm_uevhjq6GJekMhPJ1Wyxghw@mail.gmail.com>
	<CACLRvHYOp4uFbJPk_J35oDWs+fv_bpV0LrBQ4dJda_mWKgupUw@mail.gmail.com>
	<CACLRvHYzbfhkg6Z2=HdrKv6YhcipXgnyMhEz0xx1dSALDcn_hQ@mail.gmail.com>
	<ab320161-2511-2559-b190-f71b07b5d089@aklaver.com>
	<CACLRvHaB_mLCygA6AQnc5jh+cBme2A-=Su9oDyO4O20k5ZSKSw@mail.gmail.com>
	<89a62c70-4386-a3ef-f2ea-5e0f448cef11@aklaver.com>
	<CACLRvHaK2tCmXPKSrjKAiQdVV0+zMQ_Gy3onpkFXD4VLnm46Ng@mail.gmail.com>
	<0275a27c-2447-f8e5-489b-d7e419997299@aklaver.com>
	<CACLRvHYQp2BdiS1w+Pt6tHsub=x19-E+L67R2hiJFNwbHY9jYw@mail.gmail.com>
	<3874667.1614101644@sss.pgh.pa.us>
	<CACLRvHaX_6fU_uoEJv=DPNYc4bcYOrmzn+e=dWhW4-com5K9zQ@mail.gmail.com>
	<3877970.1614105611@sss.pgh.pa.us>
	<CACLRvHZHqzVddKL8_v0-cMTezuXnyMAmpYErvJC2gghreVh72g@mail.gmail.com>
	<4007188.1614128586@sss.pgh.pa.us>

On 24.02.21 02:03, Tom Lane wrote:
> [ redirecting to pgsql-bugs ]
> 
> Santosh Udupi <email@hitha.net> writes:
>> Here is my table structure.
> 
> Indeed, this looks pretty busted, both in v13 and HEAD.  It seems that
> pg_dump is not coping well with GENERATED columns attached to a
> partition parent table.  I made the attached script with a bit of
> sample data, loaded it into an empty database, and dumped it.
> The dump is evidently assuming that ALTER TABLE ATTACH PARTITION
> is going to cause the generated-ness of the columns to propagate
> to the children, but it doesn't.  There also seems to be considerable
> confusion about which columns of the child tables should be included
> in the dumped data.
> 
> I suspect this example is revealing bugs in both the backend
> (ATTACH PARTITION ought to take care of this, no?) and pg_dump
> (the backend can't be blamed for pg_dump's choices of columns
> to dump).  Peter?

The backend side of this would be fixed by the proposed 
<https://www.postgresql.org/message-id/ac35da1c-e746-ea19-bfc3-84819a4e907d%40enterprisedb.com; 
(it's the same code for ALTER TABLE ... INHERIT and ATTACH PARTITION).

The pg_dump side can apparently be fixed by adding

inline patch 1: src/bin/pg_dump/common.c (+0/-0 lines) download inline-1.patchdiff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..c210883ca3 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -585,7 +585,7 @@ flagInhAttrs(DumpOptions *dopt, TableInfo *tblinfo,
int numTables) } /* Remove generation expression from child */ - if (foundGenerated && !dopt->binary_upgrade) + if (foundGenerated && !dopt->binary_upgrade && !tbinfo->ispartition) tbinfo->attrdefs[j] = NULL; } } Looks like this was accidentally broken by the last minor release's fixes in this area.

view thread (26+ messages)  latest in thread

Message-ID: <a9d2893c-bb4a-aadf-c02d-535e752ab2b7@enterprisedb.com>
Permalink:  ../a9d2893c-bb4a-aadf-c02d-535e752ab2b7@enterprisedb.com/
Also on:    postgresql.org/message-id/a9d2893c-bb4a-aadf-c02d-535e752ab2b7@enterprisedb.com

 ·  · 

reply

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-bugs@postgresql.org
  Cc: peter.eisentraut@enterprisedb.com, tgl@sss.pgh.pa.us, email@hitha.net, adrian.klaver@aklaver.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: pg_restore - generated column - not populating
  In-Reply-To: <a9d2893c-bb4a-aadf-c02d-535e752ab2b7@enterprisedb.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