pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Cc: Michael Paquier <michael.paquier@gmail.com>
Cc: Jaime Casanova <jaime.casanova@2ndquadrant.com>
Subject: Re: [HACKERS] generated columns
Date: Thu, 22 Nov 2018 16:20:20 +0100
Message-ID: <9881dbb2-e0ec-8e75-27ca-7b049894aec2@2ndquadrant.com> (raw)
In-Reply-To: <20181119185431.7wfp6rmxtqr2ds3p@alvherre.pgsql>
References: <20181119185431.7wfp6rmxtqr2ds3p@alvherre.pgsql>

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




view thread (112+ messages)  latest in thread

Message-ID: <9881dbb2-e0ec-8e75-27ca-7b049894aec2@2ndquadrant.com>
Permalink:  ../9881dbb2-e0ec-8e75-27ca-7b049894aec2@2ndquadrant.com/
Also on:    postgresql.org/message-id/9881dbb2-e0ec-8e75-27ca-7b049894aec2@2ndquadrant.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: peter.eisentraut@2ndquadrant.com, alvherre@2ndquadrant.com, michael.paquier@gmail.com, jaime.casanova@2ndquadrant.com
  Subject: Re: [HACKERS] generated columns
  In-Reply-To: <9881dbb2-e0ec-8e75-27ca-7b049894aec2@2ndquadrant.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox