時間:2024-02-07 12:09作者:下載吧人氣:16
使用函數或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);
網友評論