Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions enginetest/queries/insert_queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -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);",
},
Expand Down
2 changes: 1 addition & 1 deletion sql/expression/function/coalesce_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
4 changes: 2 additions & 2 deletions sql/types/system_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion sql/types/typecheck_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package types
import (
"testing"

"github.com/dolthub/go-mysql-server/sql"
"github.com/stretchr/testify/assert"
)

Expand Down Expand Up @@ -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{}))
}
6 changes: 3 additions & 3 deletions sql/variables/system_variables.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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{
Expand Down