diff --git a/test/EFCore.MySql.FunctionalTests/BulkUpdates/FiltersInheritanceBulkUpdatesMySqlTest.cs b/test/EFCore.MySql.FunctionalTests/BulkUpdates/FiltersInheritanceBulkUpdatesMySqlTest.cs index f08b7ef21..dc40ddf46 100644 --- a/test/EFCore.MySql.FunctionalTests/BulkUpdates/FiltersInheritanceBulkUpdatesMySqlTest.cs +++ b/test/EFCore.MySql.FunctionalTests/BulkUpdates/FiltersInheritanceBulkUpdatesMySqlTest.cs @@ -1,7 +1,10 @@ +using System; using System.Threading.Tasks; using Microsoft.EntityFrameworkCore.BulkUpdates; using Microsoft.EntityFrameworkCore.TestUtilities; using MySqlConnector; +using Pomelo.EntityFrameworkCore.MySql.Infrastructure; +using Pomelo.EntityFrameworkCore.MySql.Tests; using Xunit; namespace Pomelo.EntityFrameworkCore.MySql.FunctionalTests.BulkUpdates; @@ -89,27 +92,35 @@ public override async Task Delete_GroupBy_Where_Select_First_2(bool async) public override async Task Delete_GroupBy_Where_Select_First_3(bool async) { - // Not supported by MySQL: - // Error Code: 1093. You can't specify target table 'c' for update in FROM clause - await Assert.ThrowsAsync( - () => base.Delete_GroupBy_Where_Select_First_3(async)); + if (AppConfig.ServerVersion.Type == ServerType.MariaDb && + AppConfig.ServerVersion.Version >= new Version(11, 1)) + { + await base.Delete_GroupBy_Where_Select_First_3(async); - AssertSql( + AssertSql( """ DELETE `a` FROM `Animals` AS `a` -WHERE (`a`.`CountryId` = 1) AND EXISTS ( - SELECT 1 - FROM `Animals` AS `a0` - WHERE `a0`.`CountryId` = 1 - GROUP BY `a0`.`CountryId` - HAVING (COUNT(*) < 3) AND (( +WHERE (`a`.`CountryId` = 1) AND `a`.`Id` IN ( + SELECT ( SELECT `a1`.`Id` FROM `Animals` AS `a1` WHERE (`a1`.`CountryId` = 1) AND (`a0`.`CountryId` = `a1`.`CountryId`) - LIMIT 1) = `a`.`Id`)) -""" -); + LIMIT 1) + FROM `Animals` AS `a0` + WHERE `a0`.`CountryId` = 1 + GROUP BY `a0`.`CountryId` + HAVING COUNT(*) < 3 +) +"""); + } + else + { + // Not supported by MySQL: + // Error Code: 1093. You can't specify target table 'c' for update in FROM clause + await Assert.ThrowsAsync( + () => base.Delete_GroupBy_Where_Select_First_3(async)); + } } public override async Task Delete_where_keyless_entity_mapped_to_sql_query(bool async)