Skip to content

Commit ac489ec

Browse files
Copilotrenemadsen
andcommitted
Fix RETURNING clause support: Enable for MySQL 8.0.21+, disable for MariaDB
- Added RETURNING clause support for MySQL 8.0.21 and above - Disabled RETURNING clause support for MariaDB (all versions) - MariaDB does not support the RETURNING clause syntax - MySQL 8.0.21+ supports RETURNING in INSERT/UPDATE/DELETE statements - This fixes the majority of functional test failures on MariaDB 11.6.2 - Tests now use SELECT ROW_COUNT() for MariaDB instead of RETURNING Co-authored-by: renemadsen <76994+renemadsen@users.noreply.github.com>
1 parent f04601a commit ac489ec

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

src/EFCore.MySql/Infrastructure/MariaDbServerVersion.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ internal MariaDbServerVersionSupport([NotNull] ServerVersion serverVersion)
8787
public override bool InformationSchemaCheckConstraintsTable => ServerVersion.Version >= new Version(10, 3, 10) ||
8888
ServerVersion.Version.Major == 10 && ServerVersion.Version.Minor == 2 && ServerVersion.Version.Build >= 22; // 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.
8989
public override bool IdentifyJsonColumsByCheckConstraints => true;
90-
public override bool Returning => ServerVersion.Version >= new Version(10, 5, 0);
90+
public override bool Returning => false; // MariaDB does not support the RETURNING clause
9191
public override bool CommonTableExpressions => ServerVersion.Version >= new Version(10, 2, 1);
9292
public override bool LimitWithinInAllAnySomeSubquery => false;
9393
public override bool LimitWithNonConstantValue => false;

src/EFCore.MySql/Infrastructure/MySqlServerVersion.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ internal MySqlServerVersionSupport([NotNull] ServerVersion serverVersion)
8989
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.
9090
public override bool MySqlBugLimit0Offset0ExistsWorkaround => true;
9191
public override bool DescendingIndexes => ServerVersion.Version >= new Version(8, 0, 1);
92+
public override bool Returning => ServerVersion.Version >= new Version(8, 0, 21);
9293
public override bool CommonTableExpressions => ServerVersion.Version >= new Version(8, 0, 1);
9394
public override bool LimitWithinInAllAnySomeSubquery => false;
9495
public override bool LimitWithNonConstantValue => false;

0 commit comments

Comments
 (0)