I'm trying the copy and generating UUID()s on the fly for exiting data when executing A insert from select.

How can I make the UUID() function statement-based replication safe? Can I somehow use the old ID's from the primary table or at least save them for the entire operation? so the replica will have the same IDs?

INSERT INTO table_name (number,REPLACE(UUID(),………(SELECT ….));

which means primary and any its slave have inconsistent data for table_name, because of the UUID func.

  • Any reason why you can't assign the UUID() result to a variable which you then use in the INSERT? – mustaccio Nov 10 '19 at 16:34
  • Have you considered using 'binlog_format=ROW'? – danblack Nov 10 '19 at 23:20

Not sure I understand the question, but if you select the uuid from the parent, Whats the problem?

Insert into t (c1, c2,..., cn)
Select 36, 'abc', c3,... FROM parent

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.