pgsql: pg_dump: Don't emit OVERRIDING SYSTEM VALUE for dropped identity

From: Fujii Masao <fujii(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: pg_dump: Don't emit OVERRIDING SYSTEM VALUE for dropped identity
Date: 2026-10-13 04:19:19
Message-ID: E1xGTyx-00000001PDM-3t7q@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

pg_dump: Don't emit OVERRIDING SYSTEM VALUE for dropped identity columns

When a table's only GENERATED ALWAYS AS IDENTITY column had been
dropped, pg_dump --inserts and --column-inserts could still emit
OVERRIDING SYSTEM VALUE in INSERT statements. This clause has no effect
when restoring into PostgreSQL but introduces unnecessary differences
between dumps of otherwise equivalent tables.

ALTER TABLE ... DROP COLUMN leaves pg_attribute.attidentity unchanged.
getTableAttrs() used this field to set needs_override without checking
attisdropped, so a dropped identity column could trigger the clause even
when no remaining column required it.

Ignore dropped columns when determining whether to emit the clause, so
that the output reflects only the table's remaining columns.

Apply to master only, since the unnecessary clause does not affect
restoration into PostgreSQL and does not warrant backpatching.

Author: William Bernbaum <wbernbaum(at)dwdev(dot)com>
Reviewed-by: Andreas Karlsson <andreas(at)proxel(dot)se>
Reviewed-by: solai v <solai(dot)cdac(at)gmail(dot)com>
Reviewed-by: shihao zhong <zhong950419(at)gmail(dot)com>
Reviewed-by: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Discussion: https://postgr.es/m/PH0PR18MB44430C10F7431F8D163CDAFFA6202@PH0PR18MB4443.namprd18.prod.outlook.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/cde33148c9d8cc432296992eaa5c2f58a126712d

Modified Files
--------------
src/bin/pg_dump/pg_dump.c | 11 ++++++-
src/bin/pg_dump/t/002_pg_dump.pl | 67 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 77 insertions(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Previous Message Michael Paquier 2026-10-13 04:02:57 pgsql: Allow a stats kind to use its own dshash in pgstats