Re: [HACKERS] generated columns

Erik Rijkers <er@xs4all.nl>

From: Erik Rijkers <er@xs4all.nl>
To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
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-02T13:36:19Z
Lists: pgsql-hackers
On 2019-04-02 14:43, Peter Eisentraut wrote:
> On 2019-04-01 10:52, Peter Eisentraut wrote:
>> On 2019-03-31 05:49, Erik Rijkers wrote:
>>> STORED in a
>>> file_fdw foreign table still silently creates the column which then
>>> turns out to be useless on SELECT, with an error like:
>>> 
>>> "ERROR:  column some_column_name is a generated column
>>> DETAIL:  Generated columns cannot be used in COPY."
>>> 
>>> Maybe it'd be possible to get an error earlier, i.e., while trying to
>>> create such a useless column?
>> 
>> I'll look into it.
> 
> I've been trying to create a test case for file_fdw for this, but I'm
> not getting your result.  Can you send a complete test case?


Ah, I had not noticed before: with an asterisk ('select * from table' ) 
one gets no error, just empty values.

An actual error seems to occur when one mentions the 
generated-column-name explicitly in the select-list.

select "id", "Ratio Log2 GEN" from <file_fdw foreign table>;
"
ERROR:  column "Ratio Log2 GEN" is a generated column
DETAIL:  Generated columns cannot be used in COPY.
"

That's from a quick test here at work; maybe that gives you enough info.

If that doesn't make it repeatable (for you) I'll make a more complete 
example this evening (from home).




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