Re: [HACKERS] generated columns

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Sergei Kornilov <sk(at)zsrv(dot)org>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Jaime Casanova <jaime(dot)casanova(at)2ndquadrant(dot)com>
Subject: Re: [HACKERS] generated columns
Date: 2019-01-13 09:43:28
Message-ID: acb103e7-a1c6-8e53-ec63-0ee02ea8dd73@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 11/01/2019 16:22, Pavel Stehule wrote:
> The documentation contains paragraph
>
> +      The generation expression can only use immutable functions and cannot
> +      use subqueries or reference anything other than the current row
> in any
> +      way.
>
> It is necessary for stored columns?

See here:
https://www.postgresql.org/message-id/b5c27634-1d44-feba-7494-ce5a31f914ca@2ndquadrant.com

> I tested it with pseudo constant - current_timestamp, session_user. But
> current_database() is disallowed.
>
> on second hand, this is strange
>
> postgres=# create table foo3 (inserted text generated always as
> (current_timestamp) virtual);
> CREATE TABLE

Ah, the volatility checking needs some improvements. I'll address that
in the next patch version.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2019-01-13 09:54:18 Re: port of INSTALL file generation to XSLT
Previous Message Peter Eisentraut 2019-01-13 09:32:59 Re: Python versions (was Re: RHEL 8.0 build)