目录 一、问题 二、定位问题 三、删除主键约束 四、增加主键约束 五、检查datax自定义json配置 六、总结 一、问题 使用datax从Hive推送数据到pg时报错 ERROR: there is no unique or ex
目录
使用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); {"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
2024-10-23
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0