ALTER TABLE ... SET DATA TYPE removes statistics

Поиск
Список
Период
Сортировка
От nikolai.berkoff
Тема ALTER TABLE ... SET DATA TYPE removes statistics
Дата
Msg-id vCc8XnwDmlP4ZnHBQLIVxzD405BiYHVC9qZlhIF7IsfxK0gC9mZ4PUUOH0-3y6kv5p-87-3_ljqT1KvQVAnb8OoWhPU3kcqWn2ZpmxRBCQg=@pm.me
обсуждение исходный текст
Ответы Re: ALTER TABLE ... SET DATA TYPE removes statistics  ("Euler Taveira" <euler@eulerto.com>)
Список pgsql-docs
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
Вложения

В списке pgsql-docs по дате отправления:

Предыдущее
От: Anitha P
Дата:
Сообщение: Fwd: PostgreSQL 12 Authentication type questions
Следующее
От: "nikolai.berkoff"
Дата:
Сообщение: vacuumdb --analyze-in-stages