Skip to content

Commit

Permalink
fix: replace mariadb's utf8mb4_uca1400_ai_ci with utf8mb4_0900_ai_ci (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
fanyang01 authored Dec 24, 2024
1 parent 87bb935 commit ebc6d05
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/replication-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
strategy:
matrix:
# source: ['mysql', 'postgres', 'dolt', 'mariadb']
source: ['mysql', 'postgres']
source: ['mysql', 'postgres', 'mariadb']
steps:
- uses: actions/checkout@v4

Expand All @@ -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
Expand Down
9 changes: 9 additions & 0 deletions backend/request_modifier.go
Original file line number Diff line number Diff line change
@@ -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)
Expand Down

0 comments on commit ebc6d05

Please sign in to comment.