Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/EFCore.MySql/Infrastructure/MySqlServerVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
9 changes: 6 additions & 3 deletions src/EFCore.MySql/Update/Internal/MySqlUpdateSqlGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand Down
Loading