The current documentation does not mention that the column statistics are removed which I can see they are in
src/backend/commands/tablecmds.c
ATExecAlterColumnType
/*
* Drop any pg_statistic entry for the column, since it's now wrong type
*/
RemoveStatistics(RelationGetRelid(rel), attnum);
Although this might be obvious it tripped me up. For example renaming and SET STATISTICS preserves statistics. Patch
attached.
Regards,
Nikolai