Re: pg_restore - generated column - not populating

Peter Eisentraut <peter.eisentraut@enterprisedb.com>

From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: Tom Lane <tgl@sss.pgh.pa.us>, Santosh Udupi <email@hitha.net>
Cc: Adrian Klaver <adrian.klaver@aklaver.com>, pgsql-bugs@lists.postgresql.org
Date: 2021-05-04T12:25:58Z
Lists: pgsql-bugs, pgsql-general
On 26.04.21 15:40, Peter Eisentraut wrote:
>> 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
> 
> diff --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.

Both of these issues have been fixed and will be in the next minor releases.



Commits

  1. pg_dump: Fix dump of generated columns in partitions