pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: Pavel Stehule <pavel.stehule@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Cc: Sergei Kornilov <sk@zsrv.org>
Cc: Michael Paquier <michael.paquier@gmail.com>
Cc: Jaime Casanova <jaime.casanova@2ndquadrant.com>
Subject: Re: [HACKERS] generated columns
Date: Sun, 13 Jan 2019 10:43:28 +0100
Message-ID: <acb103e7-a1c6-8e53-ec63-0ee02ea8dd73@2ndquadrant.com> (raw)
In-Reply-To: <CAFj8pRCnXSjxvDqDgruAbf36TEdZZHmV5=xAUbn8Pc2=wHX84A@mail.gmail.com>
References: <b151f851-4019-bdb1-699e-ebab07d2f40a@2ndquadrant.com>
	<CAJGNTeOxeQPFpEr35PME4yLayRzP_wwzt70kFrPztSTWHf-HDA@mail.gmail.com>
	<CAJGNTeM+MCjA4dBhAdjJ-vR_CwY3u65cCcc+KvnahzLHZjxjbw@mail.gmail.com>
	<1bc948f8-3bab-6c54-50af-c0723a75b85f@2ndquadrant.com>
	<20180116063546.GA3679@paquier.xyz>
	<48502d9b-60c4-5b10-40a2-e34f562132b4@2ndquadrant.com>
	<20180119051804.GC12826@paquier.xyz>
	<2e3d5147-16f8-af0f-00ab-4c72cafc896f@2ndquadrant.com>
	<20180131131804.GB1586@paquier.xyz>
	<bf9c8765-1aa0-432a-442e-45f715ebe4e7@2ndquadrant.com>
	<20180202022532.GA84623@paquier.xyz>
	<050e663d-d915-f61b-af96-5a09c10ade02@2ndquadrant.com>
	<79e4de23-52e3-2c45-9ba0-5f6932f590aa@2ndquadrant.com>
	<28574501540912440@iva5-750e13568e4d.qloud-c.yandex.net>
	<2ddd0bfa-0fcd-35ec-266c-f03cf72fc581@2ndquadrant.com>
	<26129f50-cf47-2013-8f9b-e7a98853aa69@2ndquadrant.com>
	<CAFj8pRCnXSjxvDqDgruAbf36TEdZZHmV5=xAUbn8Pc2=wHX84A@mail.gmail.com>

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




view thread (112+ messages)  latest in thread

Message-ID: <acb103e7-a1c6-8e53-ec63-0ee02ea8dd73@2ndquadrant.com>
Permalink:  ../acb103e7-a1c6-8e53-ec63-0ee02ea8dd73@2ndquadrant.com/
Also on:    postgresql.org/message-id/acb103e7-a1c6-8e53-ec63-0ee02ea8dd73@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, pavel.stehule@gmail.com, sk@zsrv.org, michael.paquier@gmail.com, jaime.casanova@2ndquadrant.com
  Subject: Re: [HACKERS] generated columns
  In-Reply-To: <acb103e7-a1c6-8e53-ec63-0ee02ea8dd73@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