Re: [HACKERS] generated columns

Peter Eisentraut <peter.eisentraut@2ndquadrant.com>

From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>, Erik Rijkers <er@xs4all.nl>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>, Sergei Kornilov <sk@zsrv.org>, Michael Paquier <michael.paquier@gmail.com>, Jaime Casanova <jaime.casanova@2ndquadrant.com>
Date: 2019-04-04T11:01:09Z
Lists: pgsql-hackers
On 2019-04-04 11:42, Amit Langote wrote:
> Hmm, I'm afraid we might get bug reports if we go with this.  Why is it OK
> to get null in this case when a user explicitly asked for 'foo'?

The way stored generated columns work on foreign tables is that the
to-be-stored value is computed, then given to the foreign table handler,
which then has to store it, and then return it later when queried.
However, since the backing store of a foreign table is typically
modifiable directly by the user via other channels, it's possible to
create situations where actually stored data does not satisfy the
generation expression.  That is the case here.  I don't know of a
principled way to prevent that.  It's just one of the problems that can
happen when you store data in a foreign table:  You have very little
control over what data actually ends up being stored.

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



Commits

  1. Generated columns

  2. Add walreceiver API to get remote server version

  3. Add pg_partition_tree to display information about partitions

  4. pg_restore: Augment documentation for -N option

  5. Change delimiter used for display of NextXID