ALTER TABLE ... SET DATA TYPE removes statistics
nikolai.berkoff <nikolai.berkoff@pm.me>
From: "nikolai.berkoff" <nikolai.berkoff@pm.me>
To: "pgsql-docs@lists.postgresql.org" <pgsql-docs@lists.postgresql.org>
Date: 2021-10-08T09:03:34Z
Lists: pgsql-docs
Attachments
- set_data_type.patch (text/x-patch) patch
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
Commits
-
Document that ALTER TABLE .. TYPE removes statistics
- df80f9da5c65 15.0 landed