BUG #17036: generated column cann't modifyed auto when update

Поиск
Список
Период
Сортировка
От PG Bug reporting form
Тема BUG #17036: generated column cann't modifyed auto when update
Дата
Msg-id 17036-e4d41f4221873a17@postgresql.org
обсуждение исходный текст
Ответы Re: BUG #17036: generated column cann't modifyed auto when update  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-bugs
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


В списке pgsql-bugs по дате отправления:

Предыдущее
От: PG Bug reporting form
Дата:
Сообщение: BUG #17035: assert after commit
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: BUG #17036: generated column cann't modifyed auto when update