From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: Michael Paquier <michael@paquier.xyz>
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: Mon, 25 Feb 2019 21:51:52 +0100
Message-ID: <039d8e26-af6a-9658-2188-33c201f16690@2ndquadrant.com> (raw)
In-Reply-To: <20190115071359.GF1433@paquier.xyz>
References: <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>
<acb103e7-a1c6-8e53-ec63-0ee02ea8dd73@2ndquadrant.com>
<CAFj8pRB=L3At5R=DXWRw7OFCdaeZ_+3S5e==DbGgD_7POsqngA@mail.gmail.com>
<20190115071359.GF1433@paquier.xyz>
On 2019-01-15 08:13, Michael Paquier wrote:
>>> Ah, the volatility checking needs some improvements. I'll address that
>>> in the next patch version.
>>
>> ok
>
> The same problem happens for stored and virtual columns.
This is fixed in v8.
> It would be nice to add a test with composite types, say something
> like:
> =# create type double_int as (a int, b int);
> CREATE TYPE
> =# create table double_tab (a int,
> b double_int GENERATED ALWAYS AS ((a * 2, a * 3)) stored,
> c double_int GENERATED ALWAYS AS ((a * 4, a * 5)) virtual);
> CREATE TABLE
> =# insert into double_tab values (1), (6);
> INSERT 0 2
> =# select * from double_tab ;
> a | b | c
> ---+---------+---------
> 1 | (2,3) | (4,5)
> 6 | (12,18) | (24,30)
> (2 rows)
I added that.
> + bool has_generated_stored;
> + bool has_generated_virtual;
> } TupleConstr;
> Could have been more simple to use a char as representation here.
Seems confusing if both apply at the same time.
> Using NULL as generation expression results in a crash when selecting
> the relation created:
> =# CREATE TABLE gtest_err_1 (a int PRIMARY KEY, b int GENERATED ALWAYS
> AS (NULL));
> CREATE TABLE
> =# select * from gtest_err_1;
> server closed the connection unexpectedly
This is fixed in v8.
> + The view <literal>column_column_usage</literal> identifies all
> generated
> "column_column_usage" is redundant. Could it be possible to come up
> with a better name?
This is specified in the SQL stnadard.
> When testing a bulk INSERT into a table which has a stored generated
> column, memory keeps growing in size linearly, which does not seem
> normal to me.
This was a silly coding error. It's fixed in v8.
> +/*
> + * Thin wrapper around libpq to obtain server version.
> + */
> +static int
> +libpqrcv_server_version(WalReceiverConn *conn)
> This should be introduced in separate patch in my opinion (needed
> afterwards for logirep).
Yes, it could be committed separately.
> What about the catalog representation of attgenerated? Would it merge
> with attidentity & co? Or not?
I think the way it is now seems best. The other options that were
discussed are also plausible, but that the discussions did not reveal
any overwhelming arguments for a a change.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
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, michael@paquier.xyz, pavel.stehule@gmail.com, sk@zsrv.org, michael.paquier@gmail.com, jaime.casanova@2ndquadrant.com
Subject: Re: [HACKERS] generated columns
In-Reply-To: <039d8e26-af6a-9658-2188-33c201f16690@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