Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: EXPOSED-340 Syntax error using upsert with MySQL8 below 8.0.19 #2049

Merged
merged 2 commits into from
Apr 17, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ internal open class MysqlFunctionProvider : FunctionProvider() {
}

val isAliasSupported = when (val dialect = transaction.db.dialect) {
is MysqlDialect -> dialect !is MariaDBDialect && dialect.isMysql8
is MysqlDialect -> dialect !is MariaDBDialect && dialect.fullVersion >= "8.0.19"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A string comparison is the easiest and passes all the comparison tests because of MySQL's predictable release versioning structure.

Alternatively, I could implement the comparison similar to how it's done in isVersionCovers, by parsing the version string and converting it to a BigDecimal first.
Parsing each version component and compare them individually is also an option.

else -> false // H2_MySQL mode also uses this function provider & requires older version
}

Expand Down Expand Up @@ -281,6 +281,10 @@ open class MysqlDialect : VendorDialect(dialectName, MysqlDataTypeProvider, Mysq
TransactionManager.current().db.isVersionCovers(BigDecimal("8.0"))
}

internal val fullVersion: String by lazy {
TransactionManager.current().db.metadata { databaseProductVersion }
}

override val supportsCreateSequence: Boolean = false

override val supportsTernaryAffectedRowValues: Boolean = true
Expand Down
Loading