当前位置: 首页 > news >正文

机加工外贸网站window优化大师

机加工外贸网站,window优化大师,网站建设专题,营销型网站建设案例LightDB 支持 ignore_row_on_dupkey_index hint LightDB 从23.4 开始支持oracle的 ignore_row_on_dupkey_index hint, 这个hint是用来忽略唯一键冲突的。类似与mysql的 insert ignore。 语法如下: 在LightDB中ignore_row_on_dupkey_index的效果等同于o…

LightDB 支持 ignore_row_on_dupkey_index hint

LightDB 从23.4 开始支持oracle的 ignore_row_on_dupkey_index hint, 这个hint是用来忽略唯一键冲突的。类似与mysql的 insert ignore。

语法如下:

Description of ignore_row_on_dupkey_index.eps follows

在LightDB中ignore_row_on_dupkey_index的效果等同于on conflict do nothing 子句。

下面说明一下这个hint的注意点以及使用示例。

注意点

  • 您必须指定一个正确的索引。如果没有指定索引,那么该语句将导致LT008错误(oracle是ORA-38912)。
  • 如果指定了多个索引,那么该语句会导致LT010错误(oracle是ORA-38915)。
  • 如果指定了index,那么索引必须存在且唯一。否则,该语句导致LT009错误(oracle是ORA-38913)。
  • IGNORE_ROW_ON_DUPKEY_INDEX提示仅适用于单表插入操作。
  • 如果指定的列对应有多个索引,那么这条语句会导致LT010错误(oracle没有这个特性,因为同一个字段不能有多个索引)。
  • 不能与on conflict 一起使用(oracle 没有on conflict)
  • 在Canopy 下,目前只支持对insert select 使用,且select 的表也需要为分布式表。

note

在ltsql 中可以通过\errverbose 查看错误码及其他详细信息

lightdb@postgres=# \errverbose
ERROR:  LT008: An index must be specified in the index hint
LOCATION:  IgnoreDupKeyHintParse, pg_hint_plan.c:7232
lightdb@postgres=# 

使用示例

初始化

create table test_ignore_dupkey(key1 int, key2 int, key3 int, key4 int);
create unique index test_ignore_dupkey_ui1 on test_ignore_dupkey(key1, key2);
create unique index test_ignore_dupkey_ui2 on test_ignore_dupkey(key3, key4);
create index test_ignore_dupkey_i on test_ignore_dupkey(key3);

示例

lightdb@postgres=# insert into test_ignore_dupkey values(1, 1, 1, 1);
INSERT 0 1
lightdb@postgres=# insert into test_ignore_dupkey values(1, 1, 1, 1);
ERROR:  duplicate key value violates unique constraint "test_ignore_dupkey_ui1"
DETAIL:  Key (key1, key2)=(1, 1) already exists.
lightdb@postgres=# insert/*+IGNORE_ROW_ON_DUPKEY_INDEX(test_ignore_dupkey  test_ignore_dupkey_ui1) */ into test_ignore_dupkey values(1, 1, 1, 2);
INSERT 0 0
lightdb@postgres=# insert/*+IGNORE_ROW_ON_DUPKEY_INDEX(test_ignore_dupkey(key1, key2)) */ into test_ignore_dupkey values(1, 1, 1, 2);
INSERT 0 0
lightdb@postgres=# insert/*+IGNORE_ROW_ON_DUPKEY_INDEX(test_ignore_dupkey) */ into test_ignore_dupkey values(1, 1, 1, 2);
ERROR:  An index must be specified in the index hint
lightdb@postgres=# insert/*+IGNORE_ROW_ON_DUPKEY_INDEX(test_ignore_dupkey test_ignore_dupkey_ui3) */ into test_ignore_dupkey values(1, 1, 1, 2);
ERROR:  An index must be specified in the index hint
lightdb@postgres=# insert/*+IGNORE_ROW_ON_DUPKEY_INDEX(test_ignore_dupkey test_ignore_dupkey_i) */ into test_ignore_dupkey values(1, 1, 1, 2);
ERROR:  Index specified in the index hint is invalid
lightdb@postgres=# insert/*+IGNORE_ROW_ON_DUPKEY_INDEX(test_ignore_dupkey test_ignore_dupkey_ui1 test_ignore_dupkey_ui2) */ into test_ignore_dupkey values(1, 1, 1, 2);
ERROR:  Multiple indexes in ignore duplicate key hint
lightdb@postgres=# update/*+IGNORE_ROW_ON_DUPKEY_INDEX(test_ignore_dupkey  test_ignore_dupkey_ui1) */ test_ignore_dupkey set key2 = 2 where key1 = 1;
ERROR:  IGNORE_ROW_ON_DUPKEY_INDEX hint disallowed for this operation
lightdb@postgres=# create unique index test_ignore_dupkey_ui3 on test_ignore_dupkey(key3, key4);
CREATE INDEX
lightdb@postgres=# insert/*+IGNORE_ROW_ON_DUPKEY_INDEX(test_ignore_dupkey(key3, key4)) */ into test_ignore_dupkey values(1, 2, 1, 1);
ERROR:  Multiple indexes in ignore duplicate key hint
DETAIL:  find multiple indexes by fields
lightdb@postgres=# insert/*+IGNORE_ROW_ON_DUPKEY_INDEX(test_ignore_dupkey  test_ignore_dupkey_ui1) */ into test_ignore_dupkey values(1, 1, 1, 2)
lightdb@postgres-# on conflict (key1, key2) do nothing;
ERROR:  IGNORE_ROW_ON_DUPKEY_INDEX hint disallowed for this operation
DETAIL:  insert operation with on confict clause is not supported
lightdb@postgres=# 下面与 oracle 不同, 对于(test_ignore_dupkey()), oracle 是hint语法错误,不会报错
lightdb@postgres=# insert/*+IGNORE_ROW_ON_DUPKEY_INDEX(test_ignore_dupkey()) */ into test_ignore_dupkey values(1, 2, 1, 1);
ERROR:  An index must be specified in the index hint
http://www.zhongyajixie.com/news/12784.html

相关文章:

  • 旅游网站的导航怎么做深圳推广
  • wordpress全屏单页济南网站优化排名
  • 安居客做网站我想做地推怎么找渠道
  • 腾讯云 wordpress搭建个人博客seo投放是什么意思
  • 服装网站建设的宗旨有哪些app推广在哪里可以接单
  • 3gcms企业手机网站整站源码asp今日山东新闻头条
  • 电子商务网站建设精品课程百度推广如何计费
  • 浙江省建设信息港的网站野狼seo团队
  • 朝阳区网站开发公司网络营销策划方案怎么写
  • 手机网站建设日程表百度灰色关键词技术
  • 内蒙古网站seo惠州seo关键字优化
  • 南京做网站工作室软文发布软件
  • 零基础建设网站视频教程做微商如何引流推广怎么找客源
  • 网站开发的公司seo关键词推广价格
  • 做色情游戏的网站有哪些郑州网站网页设计
  • 建收费网站做神马seo快速排名软件
  • 自己做app的网站seo的中文含义是什么意思
  • 平面设计软件下载官方网站今天刚刚发生的新闻最新新闻
  • 万网怎么建设网站电商运营培训正规平台
  • 亦庄网站开发安徽网站推广
  • 网站收录后才可以做排名吗怎么在百度推广自己的网站
  • 网站备案注销网站长尾关键词排名软件
  • 如何制作网站地图什么是市场营销
  • 易网官方网站宁波网站建设的公司
  • 国外企业合作的网站写手接单平台
  • 中国建设行业峰会官方网站宁波seo网站推广
  • 玉泉营网站建设宁波seo推广联系方法
  • 深圳网站建设好做app推广去哪找商家
  • 常州网络排名优化seo营销外包公司
  • 铜陵网站开发广告公司品牌营销推广