-
Notifications
You must be signed in to change notification settings - Fork 0
Fix DELETE with self-referencing subquery tests for MySQL/MariaDB < 11.0 #215
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]>
|
@copilot Same kind of error here: Failed Pomelo.EntityFrameworkCore.MySql.FunctionalTests.BulkUpdates.NorthwindBulkUpdatesMySqlTest.Delete_with_cross_join(async: False) [272 ms] |
Co-authored-by: renemadsen <[email protected]>
Fixed in commit 43049cb. The |
|
@copilot Search for other places that matches the same patteren and would require the same kind of theck for MySQL version and MariaDB versions. |
…windBulkUpdatesMySqlTest Co-authored-by: renemadsen <[email protected]>
Searched comprehensively across all bulk update test files. Found and fixed: Already Fixed:
Note: Tests with derived tables in subqueries (e.g., All affected tests now use the |
Fix DELETE with self-referencing subquery issue - COMPLETE ✅
Issue Summary
ServerVersionSupport.DeleteWithSelfReferencingSubquerytracks this capabilityChanges Made
NonSharedModelBulkUpdatesMySqlTest.Delete_predicate_based_on_optional_navigationNonSharedModelBulkUpdatesMySqlTest.Delete_entity_with_auto_includeNorthwindBulkUpdatesMySqlTest.Delete_with_cross_joinNorthwindBulkUpdatesMySqlTest.Delete_Where_OrderByMySqlExceptionon unsupported versions (MySQL, MariaDB < 11.0)Testing Results
✅ MySQL 8.0.40: All tests pass (throw MySqlException as expected)
✅ MariaDB 11.6.2: All tests pass (execute DELETE and validate SQL)
Key Finding
Tests with derived tables in subqueries (e.g.,
DELETE ... WHERE EXISTS (SELECT ... FROM (SELECT ... FROM table AS t0) AS t1)) do NOT have self-referencing issues because the derived table acts as a barrier. Only tests with direct table references in the subquery (e.g.,DELETE ... WHERE EXISTS (SELECT ... FROM table AS t0 WHERE t0.id = t.id)) are affected.Pattern for Future Tests
Tests with DELETE statements containing direct self-referencing subqueries should:
Original prompt
This section details on the original issue you should resolve
<issue_title>You can't specify target table 'p' 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: