Hi,
> > 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.
A fix for this had already been proposed here: [1]
We can continue the discussion on that thread.
[1].
https://www.postgresql.org/message-id/flat/CAN4CZFNZwcCgi-igaD%3DLH1ubxMBqJJS%2Bp4ZnOKKdCi9duaMu_w%40mail.gmail.com