Using: MySQL Workbench
I am currently working on a project for class where we have to design a airport website in which users can login/register and buy tickets for various flights offered. After working on the project for some time I realized that my trigger is not working.
I receive the error:
Error Code: 1442. Can't update table 'reservation' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
Yes, the error is self explanatory. You are trying to create a recursive trigger which is not supported in
MySQL as can be seen in your posted code
Create Trigger reservation_all after insert on Reservation for each row begin update Reservation
Check MySQL Documentation on same for more infromation. Quoting from that
Stored functions cannot be used recursively.
A stored function or trigger cannot modify a table that is already being used (for reading or writing) by the statement that invoked the function or trigger.