You want the new row updated with the UUID, so you just need to tell the trigger where to find the id
value you want updated;
CREATE TRIGGER before_insert_klienci
BEFORE INSERT ON `klienci`
FOR EACH ROW
SET NEW.`id` = uuid();
Question
I want to create a trigger:
CREATE TRIGGER before_insert_klienci
BEFORE INSERT ON `klienci`
FOR EACH ROW
SET `id` = uuid()
Unfortunately I got:
#1193 - Unknown system variable 'id'
I am completely sure that a column id
exists and I have no typo.
Any ideas?
Have a good day, Przemek
La solution
You want the new row updated with the UUID, so you just need to tell the trigger where to find the id
value you want updated;
CREATE TRIGGER before_insert_klienci
BEFORE INSERT ON `klienci`
FOR EACH ROW
SET NEW.`id` = uuid();