Re: [HACKERS] generated columns - Mailing list pgsql-hackers

From Sergei Kornilov
Subject Re: [HACKERS] generated columns
Date
Msg-id 28574501540912440@iva5-750e13568e4d.qloud-c.yandex.net
Whole thread Raw
In response to Re: [HACKERS] generated columns  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Responses Re: [HACKERS] generated columns  (Erikjan Rijkers <er@xs4all.nl>)
Re: [HACKERS] generated columns  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
List pgsql-hackers
Hi

I applied this patch on top 2fe42baf7c1ad96b5f9eb898161e258315298351 commit and found a bug while adding STORED
column:

postgres=# create table test(i int);
CREATE TABLE
postgres=# insert into test values (1),(2);
INSERT 0 2
postgres=# alter table test add column gen_stored integer GENERATED ALWAYS AS ((i * 2)) STORED;
ALTER TABLE
postgres=# alter table test add column gen_virt integer GENERATED ALWAYS AS ((i * 2));
ALTER TABLE
postgres=# table test;
 i | gen_stored | gen_virt 
---+------------+----------
 1 |            |        2
 2 |            |        4

Virtual columns was calculated on table read and its ok, but stored column does not update table data.

regards, Sergei


pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: PSA: rr recorder/debugger works well with Postgres + Linux
Next
From: Adam Brusselback
Date:
Subject: Re: Sequential UUID Generation