From 3a9081fcd469668b5aba0fe388ea2a1e6e35c943 Mon Sep 17 00:00:00 2001 From: Mudkip Date: Wed, 28 Dec 2022 12:36:16 +0000 Subject: [PATCH] Fix compatibility with MariaDB 10.10 --- .circleci/config.yml | 2 +- GNUmakefile | 4 ++-- mysql/provider.go | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 288904bd..92b2a514 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -45,5 +45,5 @@ workflows: - integration: matrix: parameters: - target: ["testversion5.6", "testversion5.7", "testversion8.0", "testpercona5.7", "testpercona8.0", "testmariadb10.3", "testmariadb10.8", "testtidb6.1.0"] + target: ["testversion5.6", "testversion5.7", "testversion8.0", "testpercona5.7", "testpercona8.0", "testmariadb10.3", "testmariadb10.8", "testmariadb10.10", "testtidb6.1.0"] - gotest diff --git a/GNUmakefile b/GNUmakefile index efd51203..41eb56f6 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -25,7 +25,7 @@ bin/terraform: testacc: fmtcheck bin/terraform PATH="$(CURDIR)/bin:${PATH}" TF_ACC=1 go test $(TEST) -v $(TESTARGS) -timeout=60s -acceptance: testversion5.6 testversion5.7 testversion8.0 testpercona5.7 testpercona8.0 testmariadb10.3 testmariadb10.8 testtidb6.1.0 +acceptance: testversion5.6 testversion5.7 testversion8.0 testpercona5.7 testpercona8.0 testmariadb10.3 testmariadb10.8 testmariadb10.10 testtidb6.1.0 testversion%: $(MAKE) MYSQL_VERSION=$* MYSQL_PORT=33$(shell echo "$*" | tr -d '.') testversion @@ -60,7 +60,7 @@ testtidb: @sh -c "'$(CURDIR)/scripts/tidb-test-cluster.sh' --destroy" testmariadb%: - $(MAKE) MYSQL_VERSION=$* MYSQL_PORT=36$(shell echo "$*" | tr -d '.') testmariadb + $(MAKE) MYSQL_VERSION=$* MYSQL_PORT=6$(shell echo "$*" | tr -d '.') testmariadb testmariadb: -docker run --rm --name test-mariadb$(MYSQL_VERSION) -e MYSQL_ROOT_PASSWORD="$(TEST_PASSWORD)" -d -p $(MYSQL_PORT):3306 mariadb:$(MYSQL_VERSION) diff --git a/mysql/provider.go b/mysql/provider.go index 86e5f2e3..8e9c597a 100644 --- a/mysql/provider.go +++ b/mysql/provider.go @@ -260,11 +260,12 @@ func quoteIdentifier(in string) string { func serverVersion(db *sql.DB) (*version.Version, error) { var versionString string - err := db.QueryRow("SELECT @@GLOBAL.innodb_version").Scan(&versionString) + err := db.QueryRow("SELECT @@GLOBAL.version").Scan(&versionString) if err != nil { return nil, err } + versionString = strings.SplitN(versionString, ":", 2)[0] return version.NewVersion(versionString) }