时间:2024-02-07 12:09作者:下载吧人气:23
使用函数或with实现
create table test(id int primary key, info text, crt_time timestamp);
with upsert as (update test set info=’test’,crt_time=now() where id=1 returning *) insert into test select 1,’test’,now() where not exists (select 1 from upsert where id=1);
网友评论