Not the answer you need?
Register and ask your own question!

replace command in binary log not working

chintoo02018chintoo02018 ContributorCurrent User Role Beginner
I have binary log edit INSERT to REPLACE to overwrite the data in table but it showing Duplicate key error
[root&#64;etim upload_new]# mysql --defaults-extra-file=/usr/bin/.config145 < BHKR_mysql-bin.002873_13-11-17_2030_1.sql
ERROR 1062 (23000) at line 32: Duplicate entry '6354429' for key 'PRIMARY'

Binary log output as below

SET INSERT_ID=6354429/*!*/;
#171113 19:32:33 server id 10 end_log_pos 5363984 CRC32 0x349ae0c3 Query thread_id=882 exec_time=0 error_code=0
SET TIMESTAMP=1510581753/*!*/;
replace into temp_ticket(waybill_no,etim_no,trip_no,route_no,bus_service,ticket_code,ticket_number,boarding_stage,boarding_stage_code,from_stage_code,alright_stage,alright_stage_code,till_stage_code,full_ticket,half_ticket,luggage_qty,pass_qty,total_amt,ticket_date,ticket_date_actual,ticket_time, pass_id,insp_conc_code,interstate_code,full_tkt_amt,half_tkt_amt,lugg_tkt_amt,lastupdate,lastupdate_id,status,bus_capacity,ttl_stages,seq_no,is_ex_tkt,uid_no,group_ticket_flag,secret_code,maharashtra_adult_amount,maharashtra_child_amount,state_1_adult_amount,state_1_child_amount,state_2_adult_amount,state_2_child_amount,state_3_adult_amount,state_3_child_amount,state_4_adult_amount,state_4_child_amount,state_5_adult_amount,state_5_child_amount,actual_adult_fare_from_db,actual_child_fare_from_db,actual_lugg_fare_from_db,original_maharashtra_adult_amount,original_maharashtra_child_amount,original_state_1_adult_amount,original_state_1_child_amount,original_state_2_adult_amount,original_state_2_child_amount,original_state_3_adult_amount,original_state_3_child_amount,original_state_4_adult_amount,original_state_4_child_amount,original_state_5_adult_amount,original_state_5_child_amount,per_adult_original_fare,per_child_original_fare,per_lugg_original_fare,reservation_charge,gprs_status,seat_no,epurse_ticket,refund_ticket_id,version_type,divisionname,divisioncode,deponame,depocode,ASN_amount,per_adult_service_tax_amount,per_child_service_tax_amount,service_charge)values('109333','BHKR5002','000L1385','61109','3','00','023849','001','OO','BHKR','009','O-','NND','02','01','00','00','0014300','12/11/17','2017-11-12','17:12:42','','00','0','0011400','0002900','0','','','','44','9','','0','','0','0','11400','2900','0','0','0','0','0','0','0','0','0','0','5670','2850','270','11400','2900','0','0','0','0','0','0','0','0','0','0','5700','2900','300','0','1','','0','0','MOFF','','','','','300','0','0','0'),('109333','BHKR5002','000L1385','61109','3','00','023850','001','OO','BHKR','004','O-','SEBLAN','01','00','00','00','0002200','12/11/17','2017-11-12','17:13:05','','00','0','0002200','0000000','0','','','','44','3.5','','0','','0','0','2200','0','0','0','0','0','0','0','0','0','0','0','2205','1100','120','2200','0','0','0','0','0','0','0','0','0','0','0','2200','0','100','



====
Create Table: CREATE TABLE `temp_ticket` (
`ticket_id` int(11) NOT NULL AUTO_INCREMENT,
`waybill_no` int(100) NOT NULL,
`etim_no` varchar(100) NOT NULL,
`trip_no` varchar(10) NOT NULL,
`route_no` int(100) NOT NULL,

`service_charge` int(20) NOT NULL,
PRIMARY KEY (`ticket_id`),
KEY `waybill_no` (`waybill_no`) USING BTREE
) ENGINE=MyISAM AUTO_INCREMENT=6595631 DEFAULT CHARSET=latin1
1 row in set (0.00 sec)
Sign In or Register to comment.

MySQL, InnoDB, MariaDB and MongoDB are trademarks of their respective owners.
Copyright ©2005 - 2020 Percona LLC. All rights reserved.