Hi, The documentation recommends running ANALYZE after the "ALTER TABLE ... SET DATA TYPE" command since the statistics will become wrong after that.
That same thing can be applied to "ALTER TABLE ... SET EXPRESSION" commands, but that is not described in the documentation, so I've attached a patch to add this statement. Regards, Yugo Nagata
diff --git a/doc/src/sgml/ref/alter_table.sgml b/doc/src/sgml/ref/alter_table.sgml index 1e4f26c13f6..85c50428a13 100644 --- a/doc/src/sgml/ref/alter_table.sgml +++ b/doc/src/sgml/ref/alter_table.sgml @@ -270,6 +270,12 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM in a stored generated column is rewritten and all the future changes will apply the new generation expression. </para> + + <para> + When this form is used, the column's statistics are removed, + so running <link linkend="sql-analyze"><command>ANALYZE</command></link> + on the table afterwards is recommended. + </para> </listitem> </varlistentry>