-
Notifications
You must be signed in to change notification settings - Fork 0
Handle MySQL/MariaDB DELETE with self-referencing subquery limitation #213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: renemadsen <[email protected]>
Co-authored-by: renemadsen <[email protected]>
|
@copilot This is related I guess: Failed Pomelo.EntityFrameworkCore.MySql.FunctionalTests.BulkUpdates.NonSharedModelBulkUpdatesMySqlTest.Delete_predicate_based_on_optional_navigation(async: False) [3 s] |
MySQL and MariaDB < 11.0 throw error 1093 "You can't specify target table for update in FROM clause" when executing DELETE statements that reference the target table in a subquery. MariaDB 11.0+ lifted this limitation. UPDATE statements behave differently: they fail on MySQL but work on all MariaDB versions.
Changes
Added
DeleteWithSelfReferencingSubqueryserver capability flagMySqlServerVersion: alwaysfalseMariaDbServerVersion:truefor version >= 11.0.0Updated DELETE tests to conditionally expect
MySqlExceptionDelete_with_LeftJoinDelete_with_LeftJoin_via_flattened_GroupJoinDelete_GroupBy_Where_Select_First_3(multiple test classes)Preserved UPDATE test behavior
Update_Where_GroupBy_First_set_constant_3continues checkingServerType.MySqlsince UPDATE works on all MariaDB versionsExample
Tests now pass on MySQL 8.0.40, MariaDB 10.5.27, and MariaDB 11.6.2.
Original prompt
This section details on the original issue you should resolve
<issue_title>You can't specify target table 'o' for update in FROM clause</issue_title>
<issue_description>With respect to the difference in MySQL and Mariadb, this is broken for MySQL v8.0.40, MariaDB 10.5.27, but it works in MariaDB 11.6.2: