fix: support account creation on pxc

This commit is contained in:
richjohnrambo
2026-09-14 14:26:29 +08:00
parent 8f849efc25
commit 2581d7b8f0
2 changed files with 52 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
//go:build mysql
package mysql
import (
"errors"
"testing"
ms "github.com/go-sql-driver/mysql"
)
func TestPXCStrictModeNamedLockError(t *testing.T) {
err := &ms.MySQLError{
Number: 1105,
Message: "Percona-XtraDB-Cluster prohibits use of GET_LOCK with pxc_strict_mode = ENFORCING",
}
if !isPXCStrictModeNamedLockError(err) {
t.Fatal("expected PXC GET_LOCK strict mode error to be recognized")
}
err = &ms.MySQLError{
Number: 1105,
Message: "Percona-XtraDB-Cluster prohibits use of RELEASE_LOCK with pxc_strict_mode = ENFORCING",
}
if !isPXCStrictModeNamedLockError(err) {
t.Fatal("expected PXC RELEASE_LOCK strict mode error to be recognized")
}
if isPXCStrictModeNamedLockError(&ms.MySQLError{Number: 1062, Message: "Duplicate entry"}) {
t.Fatal("duplicate errors must not be recognized as PXC named lock errors")
}
if isPXCStrictModeNamedLockError(errors.New("GET_LOCK failed")) {
t.Fatal("generic errors must not be recognized as PXC named lock errors")
}
}