gpt4 book ai didi

postgresql - Kettle - 使用插入/更新时出现重复键错误

转载 作者:行者123 更新时间:2023-11-29 13:11:22 38 4
gpt4 key购买 nike

我有一个 postgres 数据库,我使用 Pentaho Data Integration (Kettle) 进行 ETL。

使用具有以下配置的插入/更新框配置数据加载。

Insert/Update Configuration

但是,我从数据库中收到此错误消息。

org.pentaho.di.core.exception.KettleDatabaseException: 
Error inserting/updating row
ERROR: duplicate key value violates unique constraint "uk_cardid_cards"
Detail: Key (cardid)=(91c2eb15-75f4-4081-8b51-aebcc2fc0116) already exists.

我在另一个问题中读到,必须组成重复键才能使插入/更新框正确工作。

非常感谢任何帮助。

最佳答案

您在唯一键查找中使用了 <=,这允许获得多个 cardid+updatedate,这是不一致的。

始终使用UNIQUE 键进行插入/更新。事实上,您已经在使用此约束,但仅在 postgres 端,您必须从 pdi 端遵循相同的约束。查看表 DDL 以查看唯一性约束声明

可能它可以在查找的第二列使用 = 而不是 <= 来解决问题。

关于postgresql - Kettle - 使用插入/更新时出现重复键错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54220011/

38 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com