DDC-1337: Rollback doesn't work on transactional multi table update with mysql #1677

Open
opened 2026-01-22 13:21:54 +01:00 by admin · 0 comments
Owner

Originally created by @doctrinebot on GitHub (Aug 18, 2011).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user gedrox:

When doing transactional multi table update using DQL query the changes are not rolled back after exception is raised after the update.

    $dql = "UPDATE ..."; // some multi table update DQL
    $query = $entityManager->createQuery($dql);
    $query->execute();

throw new Exception();


});```

This is because Doctrine executes "DROP TABLE" for temporary table created for the update but MySQL is doing commit right after DROP and CREATE statements automatically.

From PHP documentation:

bq. "Some databases, including MySQL, automatically issue an implicit COMMIT when a database definition language (DDL) statement such as DROP TABLE or CREATE TABLE is issued within a transaction. The implicit COMMIT will prevent you from rolling back any other changes within the transaction boundary."
Originally created by @doctrinebot on GitHub (Aug 18, 2011). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user gedrox: When doing transactional multi table update using DQL query the changes are not rolled back after exception is raised after the update. ```html$em->transactional(function($entityManager) { $dql = "UPDATE ..."; // some multi table update DQL $query = $entityManager->createQuery($dql); $query->execute(); ``` throw new Exception(); ``` });``` This is because Doctrine executes "DROP TABLE" for temporary table created for the update but MySQL is doing commit right after DROP and CREATE statements automatically. From PHP documentation: bq. "Some databases, including MySQL, automatically issue an implicit COMMIT when a database definition language (DDL) statement such as DROP TABLE or CREATE TABLE is issued within a transaction. The implicit COMMIT will prevent you from rolling back any other changes within the transaction boundary."
admin added the Bug label 2026-01-22 13:21:54 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#1677