diff --git a/.github/workflows/replication-test.yml b/.github/workflows/replication-test.yml index 6577cd4..9d361fa 100644 --- a/.github/workflows/replication-test.yml +++ b/.github/workflows/replication-test.yml @@ -10,7 +10,7 @@ jobs: strategy: matrix: # source: ['mysql', 'postgres', 'dolt', 'mariadb'] - source: ['mysql', 'postgres'] + source: ['mysql', 'postgres', 'mariadb'] steps: - uses: actions/checkout@v4 @@ -37,9 +37,7 @@ jobs: mariadb:latest \ --gtid-strict-mode=1 \ --log-bin=mybinlog \ - --binlog-format=ROW \ - --character-set-server=utf8mb4 \ - --collation-server=utf8mb4_general_ci + --binlog-format=ROW elif [ "${{ matrix.source }}" = "dolt" ]; then # Create Dolt config diff --git a/backend/request_modifier.go b/backend/request_modifier.go index 48128bc..6932b0c 100644 --- a/backend/request_modifier.go +++ b/backend/request_modifier.go @@ -1,11 +1,20 @@ package backend +import "strings" + // RequestModifier is a function type that transforms a query string type RequestModifier func(string, *[]ResultModifier) string // default request modifier list var defaultRequestModifiers = []RequestModifier{} +// Newer MariaDB versions use utf8mb4_uca1400_ai_ci as the default collation, +// which is not supported by go-mysql-server. +// This function replaces the collation with the MySQL default utf8mb4_0900_ai_ci. +func replaceMariaDBCollation(query string, _ *[]ResultModifier) string { + return strings.ReplaceAll(query, " utf8mb4_uca1400_ai_ci", " utf8mb4_0900_ai_ci") +} + // applyRequestModifiers applies request modifiers to a query func applyRequestModifiers(query string, requestModifiers []RequestModifier) (string, []ResultModifier) { resultModifiers := make([]ResultModifier, 0)