From: Michael Paquier <michael@paquier.xyz>
To: Rahila Syed <rahilasyed90@gmail.com>
Cc: 303677365@qq.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #19833: ALTER TABLE that rebuilds an extended statistics object silently drops its SET STATISTICS target (st
Date: Thu, 12 Nov 2026 11:55:28 +0900
Message-ID: <avUqoD3yBtaUm7Y2@paquier.xyz> (raw)
In-Reply-To: <CAH2L28s+HuA54wjDUKgJSnACc5OWQT3mARHKL=Uc48yDMwvRTg@mail.gmail.com>
References: <19833-37de35b8f159e62a@postgresql.org>
<CAH2L28s+HuA54wjDUKgJSnACc5OWQT3mARHKL=Uc48yDMwvRTg@mail.gmail.com>
On Wed, Nov 11, 2026 at 04:27:37PM +0800, Rahila Syed wrote:
> ALTER TABLE st2 ALTER COLUMN c TYPE int;
>
> SELECT i.indexrelid::regclass::text AS index_name, a.attstattarget
> FROM pg_index i JOIN pg_attribute a ON a.attrelid = i.indexrelid AND
> a.attnum = 1 WHERE i.indrelid = 'st2'::regclass;
> index_name | attstattarget
> ------------+---------------
> st2_cb |
> (1 row)
Hmm, yes, that feels counter-intuitive to not preserve that.
> I will look into writing a fix for this.
Cool, thanks.
--
Michael
Attachments:
signature.asc (application/pgp-signature, 832B) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: michael@paquier.xyz, rahilasyed90@gmail.com, 303677365@qq.com
Subject: Re: BUG #19833: ALTER TABLE that rebuilds an extended statistics object silently drops its SET STATISTICS target (st
In-Reply-To: <avUqoD3yBtaUm7Y2@paquier.xyz>
References: <19833-37de35b8f159e62a@postgresql.org> <CAH2L28s+HuA54wjDUKgJSnACc5OWQT3mARHKL=Uc48yDMwvRTg@mail.gmail.com> <avUqoD3yBtaUm7Y2@paquier.xyz>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox