Re: [HACKERS] generated columns

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: [HACKERS] generated columns
Дата
Msg-id 9881dbb2-e0ec-8e75-27ca-7b049894aec2@2ndquadrant.com
обсуждение исходный текст
Ответ на Re: [HACKERS] generated columns  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Список pgsql-hackers
On 19/11/2018 19:54, Alvaro Herrera wrote:
> It's unclear why you made generated columns on partitions unsupported.
> I'd fix the limitation if possible, but if not, at least document it.

This is explained here:

+       /*
+        * Generated columns in partition key expressions:
+        *
+        * - Stored generated columns cannot work: They are computed
+        *   after BEFORE triggers, but partition routing is done
+        *   before all triggers.
+        *
+        * - Virtual generated columns could work.  But there is a
+        *   problem when dropping such a table: Dropping a table
+        *   calls relation_open(), which causes partition keys to be
+        *   constructed for the partcache, but at that point the
+        *   generation expression is already deleted (through
+        *   dependencies), so this will fail.  So if you remove the
+        *   restriction below, things will appear to work, but you
+        *   can't drop the table. :-(
+        */

> (I particularly notice that partition key is marked as unsupported in
> the regression test.  Consider partitioning on a SERIAL column, this is
> clearly something that users will expect to work.)

A serial column is not a generated column.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: [HACKERS] generated columns
Следующее
От: Alexander Kuzmenkov
Дата:
Сообщение: Re: Implement predicate propagation for non-equivalence clauses