File tree Expand file tree Collapse file tree 1 file changed +29
-2
lines changed
test/EFCore.MySql.FunctionalTests/BulkUpdates Expand file tree Collapse file tree 1 file changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -610,9 +610,35 @@ LIMIT @p0 OFFSET @p
610610
611611 public override async Task Delete_with_cross_join ( bool async )
612612 {
613- await base . Delete_with_cross_join ( async) ;
613+ if ( ! AppConfig . ServerVersion . Supports . DeleteWithSelfReferencingSubquery )
614+ {
615+ // Not supported by MySQL and older MariaDB versions:
616+ // Error Code: 1093. You can't specify target table 'o' for update in FROM clause
617+ await Assert . ThrowsAsync < MySqlException > (
618+ ( ) => base . Delete_with_cross_join ( async) ) ;
614619
615- AssertSql (
620+ AssertSql (
621+ """
622+ DELETE `o`
623+ FROM `Order Details` AS `o`
624+ WHERE EXISTS (
625+ SELECT 1
626+ FROM `Order Details` AS `o0`
627+ CROSS JOIN (
628+ SELECT 1
629+ FROM `Orders` AS `o2`
630+ WHERE `o2`.`OrderID` < 10300
631+ ORDER BY `o2`.`OrderID`
632+ LIMIT 100 OFFSET 0
633+ ) AS `o1`
634+ WHERE (`o0`.`OrderID` < 10276) AND ((`o0`.`OrderID` = `o`.`OrderID`) AND (`o0`.`ProductID` = `o`.`ProductID`)))
635+ """ ) ;
636+ }
637+ else
638+ {
639+ await base . Delete_with_cross_join ( async) ;
640+
641+ AssertSql (
616642"""
617643DELETE `o`
618644FROM `Order Details` AS `o`
@@ -628,6 +654,7 @@ LIMIT 100 OFFSET 0
628654 ) AS `o1`
629655 WHERE (`o0`.`OrderID` < 10276) AND ((`o0`.`OrderID` = `o`.`OrderID`) AND (`o0`.`ProductID` = `o`.`ProductID`)))
630656""" ) ;
657+ }
631658 }
632659
633660 public override async Task Delete_with_cross_apply ( bool async )
You can’t perform that action at this time.
0 commit comments