pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: digoal@126.com
Subject: BUG #17036: generated column cann't modifyed auto when update
Date: Wed, 26 May 2021 08:40:39 +0000
Message-ID: <17036-e4d41f4221873a17@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      17036
Logged by:          Zhou Digoal
Email address:      digoal@126.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



view thread (15+ messages)  latest in thread

Message-ID: <17036-e4d41f4221873a17@postgresql.org>
Permalink:  ../17036-e4d41f4221873a17@postgresql.org/
Also on:    postgresql.org/message-id/17036-e4d41f4221873a17@postgresql.org

 · 

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-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, digoal@126.com
  Subject: Re: BUG #17036: generated column cann't modifyed auto when update
  In-Reply-To: <17036-e4d41f4221873a17@postgresql.org>

* 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