尝试通过pgloader仅加载数据时,如何解决此约束错误?

时间:2017-05-09 19:11:30

标签: postgresql pgloader

我有以下.load文件

LOAD DATABASE
     FROM      mysql://user:password@remotelocation/mydbname
     INTO postgresql://user@localhost/dbname

 WITH data only,truncate, workers = 8, concurrency = 1

  SET maintenance_work_mem to '128MB',
      work_mem to '12MB',
      search_path to 'mydbname'

 CAST type datetime to timestamptz drop default drop not null using zero-dates-to-null,
      type mediumint with extra auto_increment to bigserial,
      type date drop not null drop default using zero-dates-to-null,
      type tinyint to boolean using tinyint-to-boolean;

我收到错误

Database error 2BP01: cannot drop constraint random_pkey on table random because other objects depend on it. 

我可以在不丢弃密钥的情况下加载数据吗?我也尝试将disable triggers参数添加到with子句中,但这也不起作用。

我正在使用postgre 9.6而pgloader的版本号是3.3.2

1 个答案:

答案 0 :(得分:0)

有两个项目解决了我的问题。第一个是默认打开include drop参数,所以我需要添加include no drop参数,其次最近修复了一些错误,所以我还需要从源代码编译pgloader。