暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

PostgreSQL 10.0 preview 功能增强 - 支持分区表ON CONFLICT .. DO NOTHING

digoal 2017-03-30
781
TAG 13

作者

digoal

日期

2017-03-30

标签

PostgreSQL , 10.0 , ON CONFLICT .. DO NOTHING


背景

目前支持分区表的ON CONFLICT .. DO NOTHING ,暂时还不支持ON CONFLICT .. DO UPDATE

```
Allow ON CONFLICT .. DO NOTHING on a partitioned table.

ON CONFLICT .. DO UPDATE still doesn't work, for lack of a way of
enforcing uniqueness across partitions, but we can still allow this
case.

Amit Langote, per discussion with Peter Geoghegan. Additional
wordsmithing by me.

Discussion: http://postgr.es/m/CAA-aLv7Z4uygtq-Q5CvDi9Y=VZxUyEnuWjL=EwCfOof=L04hgg@mail.gmail.com
```

测试

+-- check that the following works: +-- insert into partitioned_table on conflict do nothing +create table parted_conflict_test (a int, b char) partition by list (a); +create table parted_conflict_test_1 partition of parted_conflict_test for values in (1); +insert into parted_conflict_test values (1, 'a') on conflict do nothing; +insert into parted_conflict_test values (1, 'a') on conflict do nothing; +-- however, on conflict do update not supported yet +insert into parted_conflict_test values (1) on conflict (a) do update set b = excluded.b where excluded.a = 1; +ERROR: there is no unique or exclusion constraint matching the ON CONFLICT specification +drop table parted_conflict_test, parted_conflict_test_1;

参考

https://postgr.es/m/20161206034955.bh33paeralxbtluv@alap3.anarazel.de

https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=b8d7f053c5c2bf2a7e8734fe3327f6a8bc711755

https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=2f0903ea196503fc8af373a9de46b1e01a23508c

https://postgr.es/m/26088.1490315792@sss.pgh.pa.us

PostgreSQL 许愿链接

您的愿望将传达给PG kernel hacker、数据库厂商等, 帮助提高数据库产品质量和功能, 说不定下一个PG版本就有您提出的功能点. 针对非常好的提议,奖励限量版PG文化衫、纪念品、贴纸、PG热门书籍等,奖品丰富,快来许愿。开不开森.

9.9元购买3个月阿里云RDS PostgreSQL实例

PostgreSQL 解决方案集合

德哥 / digoal's github - 公益是一辈子的事.

digoal's wechat

文章转载自digoal,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论