Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mysql2pgsql 报错:relation "cms_user_setting" does not exist #112

Open
blaze-tcw opened this issue Jan 3, 2019 · 5 comments
Open

mysql2pgsql 报错:relation "cms_user_setting" does not exist #112

blaze-tcw opened this issue Jan 3, 2019 · 5 comments

Comments

@blaze-tcw
Copy link

blaze-tcw commented Jan 3, 2019

MySQL没有开启binlog(全量同步是否也必须开启binlog?)

my.cfg
`[src.mysql]
host = "10.2.1.170"
port = "5506"
user = "root"
password = "123456"
db = "db_jriboss"
encodingdir = "share"
encoding = "utf8"
binlogfile = "mysql-bin.000001"
binlogfile_offset = "4"
serverid = 10

[desc.pgsql]
connect_string = "host=127.0.0.1 dbname=DGGDC port=5432 user=gproot password=123456"
target_schema = "public"
ignore_copy_error_count_each_table = "0"`

运行命令:
./mysql2pgsql

ignore copy error count 0 each table
Starting data sync
Query to get source data for target table bus_business: select * from db_jriboss.bus_business
-- Reference DDL to create the target table:
CREATE TABLE bus_business (id int8, create_time timestamp, creater_id int8, creater_org_id int8, creater_name text, update_time timestamp, updater_id int8, updater_org_id int8, updater_name text, source_flag text, read_flag text, no text, first_follower_id int8, first_follower_organization_id int8, first_distribution_time timestamp, first_follow_time timestamp, first_call_time timestamp, follower_id int8, follower_name text, business_stage text, customer_id int8, customer_way text, customer_name text, customer_no text, customer_phone text, customer_attr text, next_follow_time timestamp, next_follow_content text, next_follow_stage text, follow_times int4, type_code text, business_status text, business_location int4, business_operate text, handle_user_id int8, handle_result text, business_organization_id int8, follower_organization_id int8, opportunitytype_code text, origin_code text, business_source_code text, extension_code text, single_org_id int8, single_user_id int8, way_code text, distribution_time timestamp, last_follow_time timestamp, will_drop_time timestamp, lose_dept_time timestamp, is_cost text, cost_price int8, order_id int8, order_no text, order_time timestamp, finish_time timestamp, area text, city text, province text, last_return_visit_time timestamp, return_visit_id int8, key_word text, source_address text, add_type_code text, is_important int4, is_vip int4, last_follow_record_user text, last_follow_record_time timestamp, last_follow_record_content text, loan_amount int8, loan_time text, loan_cycle text, loan_interrest_rate text, load_interrest_value text, repayment_type text, widely_type int4, widely_id int8, url text, invalid_number int4, special_remark text, is_mind int4, is_referral int4, group_id int8, is_return text, cost text, customer_phone_encrypt text, customer_phone_bak text, referral_audit_status int4, vip_time timestamp, is_pk int4, overdue_follow_num int4, lz_processed_time timestamp, will_processed_time timestamp, lock_time timestamp, origincode_type text, visit_status text, last_call_time timestamp, customer_flg text, bus_type_dx text, dx_allot_user text, dx_allot_user_id int8, upload_type int4, upload_time int8, upload_origin text) with (APPENDONLY=true, ORIENTATION=column, COMPRESSTYPE=zlib, COMPRESSLEVEL=1, BLOCKSIZE=1048576, OIDS=false) DISTRIBUTED BY () PARTITION BY RANGE () (START (date '') INCLUSIVE END (date '') EXCLUSIVE EVERY (INTERVAL '<1 month>' ));

table copy failed Query 'COPY "bus_business" FROM stdin DELIMITERS '|' with csv QUOTE ''''': ERROR: relation "bus_business" does not exist
Query to get source data for target table bus_business_referral: select * from db_jriboss.bus_business_referral
-- Reference DDL to create the target table:
CREATE TABLE bus_business_referral (id int8, referral_user_id int8, referral_org_id int8, referral_user_name text, receive_org_id int8, receive_user_id int8, receive_user_name text, reward_way text, referral_red int8, performance_proportion int8, tc_proportion int8, costomer_demand text, remark text, is_receive int4, current_return_org_id int8, current_return_user_id int8, current_return_user_name text, return_time timestamp, return_num int4, create_time timestamp, creater_id int8, creater_org_id int8, creater_name text, update_time timestamp, updater_id int8, updater_org_id int8, updater_name text, source_flag text, read_flag text, is_fa int4, tcred int8, fa_time timestamp, referral_organization_id int8, referral_organization_name text, referral_time timestamp, customer_id int8, referral_audit_status int4, create_type int4, audit_user_id int8, referral_type text, upload_type int4, upload_time int8, upload_origin text) with (APPENDONLY=true, ORIENTATION=column, COMPRESSTYPE=zlib, COMPRESSLEVEL=1, BLOCKSIZE=1048576, OIDS=false) DISTRIBUTED BY () PARTITION BY RANGE () (START (date '') INCLUSIVE END (date '') EXCLUSIVE EVERY (INTERVAL '<1 month>' ));

table copy failed Query 'COPY "bus_business_referral" FROM stdin DELIMITERS '|' with csv QUOTE ''''': ERROR: relation "bus_business_referral" does not exist
Query to get source data for target table cms_tree_book: select * from db_jriboss.cms_tree_book
-- Reference DDL to create the target table:
CREATE TABLE cms_tree_book (id int8, pid int8, pcode text, code text, name text, description text, levels text, sort int4, status int4, create_time timestamp, creater_id int8, creater_org_id int8, creater_name text, update_time timestamp, updater_id int8, updater_org_id int8, updater_name text, read_flag text, ext1 text, ext2 text, ext3 text, ext4 text, ext5 text, type int4, cost_type int4, upload_type int4, upload_time int8, upload_origin text) with (APPENDONLY=true, ORIENTATION=column, COMPRESSTYPE=zlib, COMPRESSLEVEL=1, BLOCKSIZE=1048576, OIDS=false) DISTRIBUTED BY () PARTITION BY RANGE () (START (date '') INCLUSIVE END (date '') EXCLUSIVE EVERY (INTERVAL '<1 month>' ));

table copy failed Query 'COPY "cms_tree_book" FROM stdin DELIMITERS '|' with csv QUOTE ''''': ERROR: relation "cms_tree_book" does not exist
Query to get source data for target table cus_record: select * from db_jriboss.cus_record
Query to get source data for target table cms_user_setting: select * from db_jriboss.cms_user_setting
-- Reference DDL to create the target table:
CREATE TABLE cms_user_setting (id int8, level text, month_num int4, is_receive int4, is_force int4, old_is_receive int4, vip_qj int4, vip_num int4, call_num text, allot_warning int4, create_time timestamp, creater_id int8, creater_name text, creater_org_id int8, update_time timestamp, updater_id int8, updater_name text, updater_org_id int8, allot_vip_num int4, business_type_code text, policy_num int4, flow_user_rank text, policy_real_num int4, last_turn int8, upload_type int4, upload_time int8, upload_origin text) with (APPENDONLY=true, ORIENTATION=column, COMPRESSTYPE=zlib, COMPRESSLEVEL=1, BLOCKSIZE=1048576, OIDS=false) DISTRIBUTED BY () PARTITION BY RANGE () (START (date '') INCLUSIVE END (date '') EXCLUSIVE EVERY (INTERVAL '<1 month>' ));

table copy failed Query 'COPY "cms_user_setting" FROM stdin DELIMITERS '|' with csv QUOTE ''''': ERROR: relation "cms_user_setting" does not exist
-- Reference DDL to create the target table:
CREATE TABLE cus_record (id int8, create_time timestamp, creater_id int8, creater_org_id int8, creater_name text, update_time timestamp, updater_id int8, updater_org_id int8, updater_name text, source_flag text, read_flag text, customer_id int8, table_name text, table_id int8, content text, record_type text, alt_json text, from_user_id int8, from_user_org_id int8, to_user_id int8, to_user_org_id int8, ext_1 text, ext_2 text, ext_3 text, ext_4 text, ext_5 text, upload_type int4, upload_time int8, upload_origin text) with (APPENDONLY=true, ORIENTATION=column, COMPRESSTYPE=zlib, COMPRESSLEVEL=1, BLOCKSIZE=1048576, OIDS=false) DISTRIBUTED BY () PARTITION BY RANGE () (START (date '') INCLUSIVE END (date '') EXCLUSIVE EVERY (INTERVAL '<1 month>' ));

table copy failed Query 'COPY "cus_record" FROM stdin DELIMITERS '|' with csv QUOTE ''''': ERROR: relation "cus_record" does not exist
Number of rows migrated: 0 (number of source tables' rows: 0)
Data sync time cost 604.850 ms
errors occured during migration

@georgeyz
Copy link

遇到了同样的问题,求解

@blaze-tcw
Copy link
Author

遇到了同样的问题,求解

目标库的表结构貌似需要先创建和源库一样

@georgeyz
Copy link

遇到了同样的问题,求解

目标库的表结构貌似需要先创建和源库一样

我创建了表,还是遇到了类似的报错

@dgqgithub
Copy link

请问有解决吗,我也遇到同样问题,表已经建了,还是报错说表不存在

@wjzeng
Copy link
Member

wjzeng commented Jun 15, 2020

如果报告 relation "xxx" does not exist ,请检查一下当前配置文件下,连接数据库的用户是否有权限访问到需要同步的表。尤其注意这些表在哪个schema。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants