14 Mar
2024
14 Mar
'24
10:40 p.m.
I just converted to MariaDB from MySQL where this trigger worked fine. DELIMITER ;; CREATE TRIGGER `email_uuid_before_insert` BEFORE INSERT ON `email` FOR EACH ROW BEGIN IF new.id_email IS NULL THEN SET new.id_email = uuid(); END IF; END;; DELIMITER ;; In MariaDB, it creates with no errors but when adding a row, I get an error 1062 : Duplicate entry '' for key 'PRIMARY' It’s caused because the last row that inserted wasn’t populated with that UUID – meaning the trigger failed. What would cause this to fail? Thank you, Steffan Cline steffan@hldns.com<mailto:steffan@hldns.com> 602-793-0014