From: | PG Bug reporting form <noreply(at)postgresql(dot)org> |
---|---|
To: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Cc: | digoal(at)126(dot)com |
Subject: | BUG #17036: generated column cann't modifyed auto when update |
Date: | 2021-05-26 08:40:39 |
Message-ID: | 17036-e4d41f4221873a17@postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
The following bug has been logged on the website:
Bug reference: 17036
Logged by: Zhou Digoal
Email address: digoal(at)126(dot)com
PostgreSQL version: 14beta1
Operating system: CentOS 7.7 x64
Description:
postgres=> create or replace function im_now () returns timestamptz as $$
select CURRENT_TIMESTAMP;
$$ language sql strict immutable;
CREATE FUNCTION
postgres=> create table t1 (id int primary key, info text, crt_time
timestamp,
mod_time
timestamptz GENERATED ALWAYS AS (im_now()) stored);
CREATE TABLE
postgres=> insert into t1 (id, info, crt_time) values (1,'test', now());
INSERT 0 1
postgres=> select * from t1;
id | info | crt_time | mod_time
----+------+----------------------------+-------------------------------
1 | test | 2021-05-26 16:38:26.675934 | 2021-05-26 16:38:26.675934+08
(1 row)
postgres=> update t1 set info='a' where id=1;
UPDATE 1
postgres=> select * from t1;
id | info | crt_time | mod_time
----+------+----------------------------+-------------------------------
1 | a | 2021-05-26 16:38:26.675934 | 2021-05-26 16:38:26.675934+08
(1 row)
why mod_time cann't updated automatic?
best regards,
digoal
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2021-05-26 12:25:00 | Re: BUG #17036: generated column cann't modifyed auto when update |
Previous Message | Masahiko Sawada | 2021-05-26 08:00:22 | Re: [BUG] Autovacuum not dynamically decreasing cost_limit and cost_delay |