support ALTER TABLE DROP EXPRESSION for virtual generated column

Поиск
Список
Период
Сортировка
От jian he
Тема support ALTER TABLE DROP EXPRESSION for virtual generated column
Дата
Msg-id CACJufxEE3edZ3UDSLHa_6Xmj8pbsHEcnJCjppAb_gqwetGdjxQ@mail.gmail.com
обсуждение исходный текст
Ответы Re: support ALTER TABLE DROP EXPRESSION for virtual generated column
Список pgsql-hackers
hi.

the attached patch is to implement $subject.
the generation expression will be dropped.
the column value previous was NULL will be materialized
based on generation expression.

It seems fairly straightforward:
drop the generation expression in ATExecDropExpression,
and instruct phase 3 to compute the generation expression
and do the table rewrite.

the doc changes:

      <para>
-      This form turns a stored generated column into a normal base column.
-      Existing data in the columns is retained, but future changes will no
-      longer apply the generation expression.
-     </para>
-
-     <para>
-      This form is currently only supported for stored generated columns (not
-      virtual ones).
+      This form turns a generated column into a normal base column.
+      For stored generated column, existing data in the columns is retained;
+      For virtual generated column, it will compute the generation
expression and
+      store the value in the columns. For inheritance hierarchy or
partition hierarchy,
+      the virtual generation expression is computed based on the
child's own generation expression.
+      The future changes will no longer apply the generation expression.
      </para>

Вложения

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