尝试通过 pgloader 仅加载数据时如何解决此约束错误?
How can I resolve this constraint error when trying to load only data via 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
有两项解决了我的问题。第一个是默认打开 include drop
参数,所以我需要添加 include no drop
参数,第二个是最近修复了这个区域的一些错误,所以我还需要从源代码编译 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
有两项解决了我的问题。第一个是默认打开 include drop
参数,所以我需要添加 include no drop
参数,第二个是最近修复了这个区域的一些错误,所以我还需要从源代码编译 pgloader。