diff --git a/src/EFCore.MySql/Infrastructure/MySqlServerVersion.cs b/src/EFCore.MySql/Infrastructure/MySqlServerVersion.cs index 6a82a5611..6d73ead8d 100644 --- a/src/EFCore.MySql/Infrastructure/MySqlServerVersion.cs +++ b/src/EFCore.MySql/Infrastructure/MySqlServerVersion.cs @@ -89,7 +89,7 @@ internal MySqlServerVersionSupport([NotNull] ServerVersion serverVersion) public override bool InformationSchemaCheckConstraintsTable => ServerVersion.Version >= new Version(8, 0, 16); // MySQL is missing the explicit TABLE_NAME column that MariaDB supports, so always join the TABLE_CONSTRAINTS table when accessing CHECK_CONSTRAINTS for any database server that supports CHECK_CONSTRAINTS. public override bool MySqlBugLimit0Offset0ExistsWorkaround => true; public override bool DescendingIndexes => ServerVersion.Version >= new Version(8, 0, 1); - public override bool Returning => ServerVersion.Version >= new Version(8, 0, 21); + public override bool Returning => false; // MySQL does not support the RETURNING clause public override bool CommonTableExpressions => ServerVersion.Version >= new Version(8, 0, 1); public override bool LimitWithinInAllAnySomeSubquery => false; public override bool LimitWithNonConstantValue => false; diff --git a/src/EFCore.MySql/Update/Internal/MySqlUpdateSqlGenerator.cs b/src/EFCore.MySql/Update/Internal/MySqlUpdateSqlGenerator.cs index db5370991..5d4c3b4ad 100644 --- a/src/EFCore.MySql/Update/Internal/MySqlUpdateSqlGenerator.cs +++ b/src/EFCore.MySql/Update/Internal/MySqlUpdateSqlGenerator.cs @@ -64,7 +64,8 @@ public override ResultSetMapping AppendInsertReturningOperation( AppendValuesHeader(commandStringBuilder, writeOperations); AppendValues(commandStringBuilder, name, schema, writeOperations); - // MySQL supports RETURNING clause starting from version 8.0.21 + // RETURNING is not supported by MySQL. MariaDB supports INSERT/DELETE RETURNING but not UPDATE RETURNING, + // so we disable it for both databases to ensure consistent behavior across all DML operations. if (_options.ServerVersion.Supports.Returning && readOperations.Count > 0) { AppendReturningClause(commandStringBuilder, readOperations); @@ -226,7 +227,8 @@ protected override ResultSetMapping AppendUpdateReturningOperation( AppendUpdateCommandHeader(commandStringBuilder, name, schema, writeOperations); AppendWhereClause(commandStringBuilder, conditionOperations); - // MySQL supports RETURNING clause starting from version 8.0.21 + // RETURNING is not supported by MySQL. MariaDB supports INSERT/DELETE RETURNING but not UPDATE RETURNING, + // so we disable it for both databases to ensure consistent behavior across all DML operations. if (_options.ServerVersion.Supports.Returning) { AppendReturningClause(commandStringBuilder, readOperations, anyReadOperations ? null : "1"); @@ -271,7 +273,8 @@ protected override ResultSetMapping AppendDeleteReturningOperation( AppendDeleteCommandHeader(commandStringBuilder, name, schema); AppendWhereClause(commandStringBuilder, conditionOperations); - // MySQL supports RETURNING clause starting from version 8.0.21 + // RETURNING is not supported by MySQL. MariaDB supports INSERT/DELETE RETURNING but not UPDATE RETURNING, + // so we disable it for both databases to ensure consistent behavior across all DML operations. if (_options.ServerVersion.Supports.Returning) { AppendReturningClause(commandStringBuilder, [], "1");