iis服务器助手广告广告
返回顶部
首页 > 资讯 > 数据库 >Postgre SQL ERROR:there is no unique or exclusion constraint matching the ON CONFLICT specification
  • 837
分享到

Postgre SQL ERROR:there is no unique or exclusion constraint matching the ON CONFLICT specification

数据库mysqlintellij-idea 2023-09-02 11:09:29 837人浏览 安东尼
摘要

目录 一、问题 二、定位问题 三、删除主键约束 四、增加主键约束 五、检查datax自定义json配置 六、总结 一、问题 使用datax从Hive推送数据到pg时报错  ERROR: there is no unique or ex

目录

一、问题

二、定位问题

三、删除主键约束

四、增加主键约束

五、检查datax自定义json配置

六、总结


一、问题

使用datax从Hive推送数据到pg时报错

 ERROR: there is no unique or exclusion constraint matching the ON CONFLICT specification  Call getNextException to see other errors in the batch.

 

二、定位问题

从报错内容很明显能看出来是主键约束出了问题,检查一下我们的主键设置

三、删除主键约束

ALTER TABLE public.table_name  DROP CONSTRAINT table_name_pkey;

四、增加主键约束

ALTER TABLE public.table_name  add primary key (id,col1);

五、检查datax自定义JSON配置

{"job": {"setting": {"speed": {"channel": 1},        "errorLimit": {            "record": 0,            "percentage": 0.02            }},"content": [{"reader": {                    "name": "hdfsreader",                    "parameter": {                        "path": "/user/hive/warehouse/db_name.db/table_name",                        "defaultFS": "hdfs://ip:host",                        "column": [   {    "index": 0,    "type": "string"   },   {    "index": 1,    "type": "string"   },   {    "index": 2,    "type": "string"   }                        ],                        "fileType": "orc",                        "encoding": "UTF-8",                        "fieldDelimiter": "\t"                    }                },"writer": {                    "name": "postgresqlwriter",                    "parameter": {                        "print": true,                        "encoding": "UTF-8",                        "username": "u",                        "passWord": "p",                        "column": [                        "id","col1",                        "col2"                    ],                    "connection": [                        {"jdbcUrl": "jdbc:postgresql://ip:host/db_name","table": ["public.table_name"]                        }                    ],                    "writeMode": "update (id,col1)"}                }            }        ]    }}

ps:我本次的报错原因是datax的主键约束跟pg表结构主键约束不一致导致的555

六、总结

1.检查目标表主键约束

2.检查datax json主键约束

来源地址:https://blog.csdn.net/chimchim66/article/details/129202268

您可能感兴趣的文档:

--结束END--

本文标题: Postgre SQL ERROR:there is no unique or exclusion constraint matching the ON CONFLICT specification

本文链接: https://www.lsjlt.com/news/390630.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作