Re: ALTER TABLE ... SET DATA TYPE removes statistics

Поиск
Список
Период
Сортировка
От Euler Taveira
Тема Re: ALTER TABLE ... SET DATA TYPE removes statistics
Дата
Msg-id 99443f30-4c03-40e5-b403-055e1f3e706d@www.fastmail.com
обсуждение исходный текст
Ответ на ALTER TABLE ... SET DATA TYPE removes statistics  ("nikolai.berkoff" <nikolai.berkoff@pm.me>)
Ответы Re: ALTER TABLE ... SET DATA TYPE removes statistics  (Michael Paquier <michael@paquier.xyz>)
Список pgsql-docs
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

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

Предыдущее
От: "Euler Taveira"
Дата:
Сообщение: Re: vacuumdb --analyze-in-stages
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: vacuumdb --analyze-in-stages