Transaction Rollbacks

Learn how to roll back the changes in case of errors within transactions.

Not all errors cause a transaction to roll back and cancel all the commands it contains. For example, if a timeout occurs on the client’s side, there will be an error, but changes made prior to the timeout will be saved. Also, errors related to constraint violation do not make the transaction roll back, by default.

Example: Constraint violation

Let’s try setting NULL to a column that does not allow NULL values:

Get hands-on with 1200+ tech skills courses.