diff --git a/enginetest/queries/insert_queries.go b/enginetest/queries/insert_queries.go index acf36bf2d0..be37ad86c7 100644 --- a/enginetest/queries/insert_queries.go +++ b/enginetest/queries/insert_queries.go @@ -1278,10 +1278,10 @@ var InsertScripts = []ScriptTest{ }, }, { - Name: "sql_mode=NO_AUTO_VALUE_ON_ZERO", + Name: "sql_mode=NO_auto_value_ON_ZERO", SetUpScript: []string{ "set @old_sql_mode=@@sql_mode;", - "set @@sql_mode='NO_AUTO_VALUE_ON_ZERO';", + "set @@sql_mode='NO_auto_value_ON_ZERO';", "create table auto (i int auto_increment, index (i));", "create table auto_pk (i int auto_increment primary key);", }, diff --git a/sql/expression/function/coalesce_test.go b/sql/expression/function/coalesce_test.go index dbb9e1894d..887c975a16 100644 --- a/sql/expression/function/coalesce_test.go +++ b/sql/expression/function/coalesce_test.go @@ -213,7 +213,7 @@ func TestCoalesce(t *testing.T) { { name: "coalesce(sysSet)", input: []sql.Expression{ - expression.NewLiteral("abc", types.NewSystemSetType("str1", "abc")), + expression.NewLiteral("abc", types.NewSystemSetType("str1", sql.Collation_Default, "abc")), }, expected: "abc", typ: types.MustCreateSetType([]string{"abc"}, sql.Collation_Default), diff --git a/sql/types/system_set.go b/sql/types/system_set.go index f6a3b24c68..a0054d3c5b 100644 --- a/sql/types/system_set.go +++ b/sql/types/system_set.go @@ -34,8 +34,8 @@ var _ sql.SystemVariableType = systemSetType{} var _ sql.CollationCoercible = systemSetType{} // NewSystemSetType returns a new systemSetType. -func NewSystemSetType(varName string, values ...string) sql.SystemVariableType { - return systemSetType{MustCreateSetType(values, sql.Collation_Default), varName} +func NewSystemSetType(varName string, collation sql.CollationID, values ...string) sql.SystemVariableType { + return systemSetType{MustCreateSetType(values, collation), varName} } // Compare implements Type interface. diff --git a/sql/types/typecheck_test.go b/sql/types/typecheck_test.go index 2a88cb82aa..ea8bdc7305 100644 --- a/sql/types/typecheck_test.go +++ b/sql/types/typecheck_test.go @@ -17,6 +17,7 @@ package types import ( "testing" + "github.com/dolthub/go-mysql-server/sql" "github.com/stretchr/testify/assert" ) @@ -93,6 +94,6 @@ func TestSystemTypesIsSet(t *testing.T) { assert.False(t, IsSet(systemUintType{})) assert.False(t, IsSet(systemDoubleType{})) assert.False(t, IsSet(systemEnumType{})) - assert.True(t, IsSet(NewSystemSetType("", ""))) + assert.True(t, IsSet(NewSystemSetType("", sql.Collation_Default, ""))) assert.False(t, IsSet(systemStringType{})) } diff --git a/sql/variables/system_variables.go b/sql/variables/system_variables.go index 0df108d8bb..0e829ff741 100644 --- a/sql/variables/system_variables.go +++ b/sql/variables/system_variables.go @@ -1283,7 +1283,7 @@ var systemVars = map[string]sql.SystemVariable{ Scope: sql.GetMysqlScope(sql.SystemVariableScope_Global), Dynamic: true, SetVarHintApplies: false, - Type: types.NewSystemSetType("log_output", "TABLE", "FILE", "NONE"), + Type: types.NewSystemSetType("log_output", sql.Collation_utf8mb4_0900_ai_ci, "TABLE", "FILE", "NONE"), Default: "FILE", }, "log_queries_not_using_indexes": &sql.MysqlSystemVariable{ @@ -1951,7 +1951,7 @@ var systemVars = map[string]sql.SystemVariable{ Scope: sql.GetMysqlScope(sql.SystemVariableScope_Global), Dynamic: true, SetVarHintApplies: false, - Type: types.NewSystemSetType("protocol_compression_algorithms", "zlib", "zstd", "uncompressed"), + Type: types.NewSystemSetType("protocol_compression_algorithms", sql.Collation_latin1_swedish_ci, "zlib", "zstd", "uncompressed"), Default: "zlib,zstd,uncompressed", }, "protocol_version": &sql.MysqlSystemVariable{ @@ -2430,7 +2430,7 @@ var systemVars = map[string]sql.SystemVariable{ Scope: sql.GetMysqlScope(sql.SystemVariableScope_Both), Dynamic: true, SetVarHintApplies: true, - Type: types.NewSystemSetType("sql_mode", "ALLOW_INVALID_DATES", "ANSI_QUOTES", "ERROR_FOR_DIVISION_BY_ZERO", "HIGH_NOT_PRECEDENCE", "IGNORE_SPACE", "NO_AUTO_VALUE_ON_ZERO", "NO_BACKSLASH_ESCAPES", "NO_DIR_IN_CREATE", "NO_ENGINE_SUBSTITUTION", "NO_UNSIGNED_SUBTRACTION", "NO_ZERO_DATE", "NO_ZERO_IN_DATE", "ONLY_FULL_GROUP_BY", "PAD_CHAR_TO_FULL_LENGTH", "PIPES_AS_CONCAT", "REAL_AS_FLOAT", "STRICT_ALL_TABLES", "STRICT_TRANS_TABLES", "TIME_TRUNCATE_FRACTIONAL", "TRADITIONAL", "ANSI"), + Type: types.NewSystemSetType("sql_mode", sql.Collation_utf8mb4_0900_ai_ci, "ALLOW_INVALID_DATES", "ANSI_QUOTES", "ERROR_FOR_DIVISION_BY_ZERO", "HIGH_NOT_PRECEDENCE", "IGNORE_SPACE", "NO_AUTO_VALUE_ON_ZERO", "NO_BACKSLASH_ESCAPES", "NO_DIR_IN_CREATE", "NO_ENGINE_SUBSTITUTION", "NO_UNSIGNED_SUBTRACTION", "NO_ZERO_DATE", "NO_ZERO_IN_DATE", "ONLY_FULL_GROUP_BY", "PAD_CHAR_TO_FULL_LENGTH", "PIPES_AS_CONCAT", "REAL_AS_FLOAT", "STRICT_ALL_TABLES", "STRICT_TRANS_TABLES", "TIME_TRUNCATE_FRACTIONAL", "TRADITIONAL", "ANSI"), Default: sql.DefaultSqlMode, }, "sql_notes": &sql.MysqlSystemVariable{