I've simple transaction here;
START TRANSACTION;
INSERT INTO user_photos(id, user_id, meta, upload_timestamp) VALUES (1211, 1, '{"a"}',
from_unixtime(unix_timestamp()));
UPDATE user_photos set user_id = '{"test"}' WHERE user_id = 1;
COMMIT;
The INSERT statement will work but the second statement, the UPDATE statement, will fail as the user_id column has type of INTEGER.
I would like to have a transaction which will rollback if any statement(inside transaction) fails. This transaction doesn't behave like that.
I use INNODB engine. Why is this transaction not working?