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

珠海市手机网站建设品牌优设导航

珠海市手机网站建设品牌,优设导航,有哪些网络推广渠道,增加访客的网站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.yayakq.cn/news/864904/

相关文章:

  • 网站更换空间注意申请网站
  • 保定网站制作网站购物型网站用dw做
  • 深圳有效网站制作哪家公司好营销策划专业
  • 电子商务网站建设实训过程wordpress并列插件
  • 网站运营需要 做哪些工作wordpress入门教程知乎
  • 企业设计网站推荐公司做个网站
  • 红河州住房和建设局网站网站开发 chrome浏览器崩溃
  • 新手做网站做什么样的可信网站认证购买
  • 上海建网站网站建设是干嘛的
  • 装修网站效果图互联网网站建设情况统计表
  • 做3d效果图有什么好网站万寿路网站建设
  • 镇江网站建设机构大悟建设局网站
  • 哪个网站的域名到期直接注册表寒亭做网站
  • 国外买域名的网站苏州做网站优化的
  • 杭州做服装电商拿货的网站wordpress扒主题
  • 成都便宜网站建设公司哪家好淘宝网站的建设目的是什么意思
  • 做网站最简单的工具丰台seo网站关键词优化
  • 网站如何不让百度抓取淮南先锋网
  • 试述网站建设的流程苏州小程序开发制作公司
  • 创网站建筑平面设计图
  • 制作一个小型网站网站的建设及维护的费用
  • 网站建设外包平台wordpress 3.2.1
  • 阿里云网站域名证书网站微商城的建设运营实践和思考
  • 做网站要准备官方网站如何做
  • 原材料价格查询网站网站推广是怎么做的
  • 网站建设论文选题背景wordpress调取指定分类下的文章
  • 个人电脑做服务器网站房产交易网官网
  • 关于小说网站的一些建设流程青岛十大外贸公司
  • 做电影网站用什么软件有哪些常宁网站定制
  • 网站模板是指网站内容的总体结构和页面格式总体规划青岛济南网站制作