Preserve statistics targets with ALTER TABLE ALTER COLUMN TYPE

From: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Preserve statistics targets with ALTER TABLE ALTER COLUMN TYPE
Date: 2026-08-14 22:37:53
Message-ID: CAN4CZFNZwcCgi-igaD=LH1ubxMBqJJS+p4ZnOKKdCi9duaMu_w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello!

While looking at 6713a6e04cb I noticed a similar issue with statistics
targets: ALTER TABLE ALTER COLUMN TYPE forgets the statistics targets
when it recreates the extended statistics that depend on the altered
column, or on an index that depends on the altered column.

The attached patches fix this limitation.

Attachment Content-Type Size
0002-Preserve-statistics-targets-of-indexes-rebuilt-by-AL.patch application/octet-stream 12.4 KB
0001-Preserve-statistics-target-of-extended-statistics-re.patch application/octet-stream 11.5 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2026-08-14 23:10:54 Re: Row pattern recognition
Previous Message Zsolt Parragi 2026-08-14 21:46:18 Re: Allow table AMs to define their own reloptions