2021
01-29
01-29
postgresql 实现replace into功能的代码
PostgreSQL9.5-使用函数或with实现createtabletest(idintprimarykey,infotext,crt_timetimestamp);withupsertas(updatetestsetinfo='test',crt_time=now()whereid=1returning*)insertintotestselect1,'test',now()wherenotexists(select1fromupsertwhereid=1);PostgreSQL9.5+PostgreSQL9.5引入了一项新功能,UPSERT(insertonconflictdo),当插入遇到约束错误时,直接返回,或者改为执行U...
继续阅读 >