On Fri, Oct 8, 2021, at 6:03 AM, nikolai.berkoff wrote: > 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. I agree that it might surprise an user and it would be good to document it. However, it does not belong to the description. I would add it to the Notes section at the end of the ALTER TABLE page.
-- Euler Taveira EDB https://www.enterprisedb.com/