Re: BUG #19845: pg_dump extended stats break when column numbers change on restore

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: 125atishprak(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19845: pg_dump extended stats break when column numbers change on restore
Date: 2026-11-08 05:30:34
Message-ID: avAI-iyJBMOF27WF@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Sat, Nov 07, 2026 at 02:19:57PM +0000, PG Bug reporting form wrote:
> pg_dump now emits pg_restore_extended_stats() calls, but pg_ndistinct and
> pg_dependencies values, and the column order of MCV lists, are tied to
> attribute
> numbers. A plain dump does not preserve attribute numbers, so the restored
> stats
> can be lost or, worse, silently applied to the wrong columns.

That's a known thing. Being able to preserve logical order of
attributes across dump-restore is something that has been proposed in
the past, and not something that should be fixed here. This has been
mentioned previously, and this answer is the same one as I gave
previously.
--
Michael

In response to

Browse pgsql-bugs by date

  From Date Subject
Previous Message shihao zhong 2026-11-08 03:23:00 Re: BUG #19808: NOT NULL NO INHERIT copied by CREATE TABLE (LIKE) not enforced on partitioned table