Re: BUG #16622: pg_dump produces erroneus ALTER TABLE statement for a table with an inherited generated column - Mailing list pgsql-bugs

From Daniel Gustafsson
Subject Re: BUG #16622: pg_dump produces erroneus ALTER TABLE statement for a table with an inherited generated column
Date
Msg-id 3B0AA616-F9E9-40F4-9350-2F82E6E88BC9@yesql.se
Whole thread Raw
In response to BUG #16622: pg_dump produces erroneus ALTER TABLE statement for a table with an inherited generated column  (PG Bug reporting form <noreply@postgresql.org>)
Responses Re: BUG #16622: pg_dump produces erroneus ALTER TABLE statement for a table with an inherited generated column  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
> On 18 Sep 2020, at 06:58, PG Bug reporting form <noreply@postgresql.org> wrote:

> psql:dump.sql:50: ERROR:  column "b" of relation "gtest1_1" is a generated
> column

I can reproduce this in git HEAD too.  Off the cuff, ISTM that we should only
dump attrdefs for local columns during non-upgrade dumps?  It works for normal
DEFAULTs but the restored db will have different :location for the attrdef.
For generated columns it errors out as shown above.  I don't really follow the
reason for why we redo the normal DEFAULT for non-local columns today, is that
intentional?

The attached, potentially naive, patch fixes the above issue and passes pg_dump
and pg_upgrade tests.

cheers ./daniel


Attachment

pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #16623: JSON select query result is getting differed when we change DB version
Next
From: Tom Lane
Date:
Subject: Re: BUG #16623: JSON select query result is getting differed when we change DB version