我有一个aws postgres rds,在这个数据库下有两个数据库,因此我想将一个数据库表数据导入到另一个数据库表中,这意味着表到表的数据传输,但是在导入表时会遇到诸如约束和fkey错误的错误数据从一个表到另一个表。我听说过一些XML数据文件解决方案,可以将其从一个表导出和导入到另一个表,但是不确定该选项。 可以建议是否有人对aws postgres rd做过类似的事情。 尝试使用以下选项在AWS postgres RDS下将一个数据库表从一个数据库表转储并还原到另一数据库表,但出错。
pg_dump -h <dns name> -U <user name> -p 5432 -t <table name> -d <db a> -f bkp.sql -v
psql -h <dns name> -U <user name> -p 5432 --table <table name> -d <db b>-f bkp.xml -verbose
面对下面的错误
SET
SET
SET
SET
SET
set_config
------------
(1 row)
SET
SET
SET
SET
SET
SET
psql:bkpq.bkp:42: ERROR: relation "testtable" already exists
ALTER TABLE
COMMENT
COMMENT
COMMENT
COMMENT
COMMENT
COMMENT
COMMENT
COMMENT
COMMENT
COMMENT
COMMENT
COMMENT
COMMENT
COMMENT
psql:bkpq.bkp:154: ERROR: relation "testtable _id_seq" already exists
ALTER TABLE
ALTER SEQUENCE
ALTER TABLE
psql:bkpq.bkp:253: ERROR: duplicate key value violates unique constraint "testtable _pkey"
DETAIL: Key (id)=(84) already exists.
CONTEXT: COPY testtable, line 1
setval
--------
129
(1 row)
psql:bkpq.bkp:268: ERROR: multiple primary keys for table "testtable " are not allowed
psql:bkpq.bkp:276: ERROR: relation "testtable _unique_name" already exists
psql:bkpq.bkp:283: ERROR: relation "testtable_process_platform_process_id_index" already exists
psql:bkpq.bkp:290: ERROR: relation "testtable _process_platform_process_type_id_index" already exists
psql:bkpq.bkp:298: ERROR: constraint "testtable _process_create_uid_fkey" for relation "" already exists
psql:bkpq.bkp:306: ERROR: constraint "testtable _process_partner_process_model_id_fkey" for relation "testtable" already exists
psql:bkpq.bkp:314: ERROR: constraint "testtable _process_product_template_process_model_id_fkey" for relation "testtable" already exists
psql:bkpq.bkp:322: ERROR: constraint "testtable _process_quote_item_wizard_process_config_model_id_fkey" for relation "testtable" already exists
psql:bkpq.bkp:330: ERROR: constraint " testtable_process_type_id_fkey" for relation "testtable" already exists
psql:bkpq.bkp:338: ERROR: constraint "testtable _process_write_uid_fkey" for relation "testtable " already exists
GRANT
GRANT
GRANT