| From: | "Euler Taveira" <euler(at)eulerto(dot)com> |
|---|---|
| To: | "nikolai(dot)berkoff" <nikolai(dot)berkoff(at)pm(dot)me>, "pgsql-docs(at)lists(dot)postgresql(dot)org" <pgsql-docs(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: ALTER TABLE ... SET DATA TYPE removes statistics |
| Date: | 2021-10-18 20:15:59 |
| Message-ID: | 99443f30-4c03-40e5-b403-055e1f3e706d@www.fastmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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
EDB https://www.enterprisedb.com/
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Alvaro Herrera | 2021-10-18 23:02:11 | Re: vacuumdb --analyze-in-stages |
| Previous Message | Euler Taveira | 2021-10-18 18:12:34 | Re: vacuumdb --analyze-in-stages |