From 37bb60e0507850d76eeb667649d0989fb54de9b8 Mon Sep 17 00:00:00 2001 From: jennifersp <44716627+jennifersp@users.noreply.github.com> Date: Fri, 22 Apr 2022 11:41:49 -0700 Subject: [PATCH] add TRADITIONAL to sql_mode set (#967) --- enginetest/variable_queries.go | 10 ++++++++++ sql/system_variables.go | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/enginetest/variable_queries.go b/enginetest/variable_queries.go index cede9a66dd..caebbc9a4b 100644 --- a/enginetest/variable_queries.go +++ b/enginetest/variable_queries.go @@ -202,6 +202,16 @@ var VariableQueries = []ScriptTest{ {"ALLOW_INVALID_DATES"}, }, }, + { + Name: "set sql_mode variable from mysqldump", + SetUpScript: []string{ + `SET sql_mode = 'STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_ENGINE_SUBSTITUTION'`, + }, + Query: "SELECT @@sql_mode", + Expected: []sql.Row{ + {"ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,STRICT_ALL_TABLES,STRICT_TRANS_TABLES,TRADITIONAL"}, + }, + }, // User variables { Name: "set user var", diff --git a/sql/system_variables.go b/sql/system_variables.go index d0e9957b93..1e14f739b0 100644 --- a/sql/system_variables.go +++ b/sql/system_variables.go @@ -2282,7 +2282,7 @@ var systemVars = map[string]SystemVariable{ Scope: SystemVariableScope_Both, Dynamic: true, SetVarHintApplies: true, - Type: 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"), + Type: 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"), Default: "STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION", }, "sql_notes": {