diff --git a/enginetest/queries/queries.go b/enginetest/queries/queries.go index c674702f43..625a027e08 100644 --- a/enginetest/queries/queries.go +++ b/enginetest/queries/queries.go @@ -4996,6 +4996,20 @@ Select * from ( {"version_comment", "Dolt"}, {"version_compile_machine", ""}, {"version_compile_os", ""}, {"version_compile_zlib", ""}, {"wait_timeout", 28800}, {"windowing_use_high_precision", 1}, }, }, + { + Query: `SHOW VARIABLES WHERE "1" and variable_name = 'autocommit'`, + Expected: []sql.Row{ + {"autocommit", 1}, + }, + }, + { + Query: `SHOW VARIABLES WHERE "0" and variable_name = 'autocommit'`, + Expected: []sql.Row{}, + }, + { + Query: `SHOW VARIABLES WHERE "abc" and variable_name = 'autocommit'`, + Expected: []sql.Row{}, + }, { Query: `SHOW GLOBAL VARIABLES LIKE '%mode'`, Expected: []sql.Row{ diff --git a/sql/rowexec/show.go b/sql/rowexec/show.go index 1c4de7098c..42bb8d027b 100644 --- a/sql/rowexec/show.go +++ b/sql/rowexec/show.go @@ -529,7 +529,12 @@ func (b *BaseBuilder) buildShowVariables(ctx *sql.Context, n *plan.ShowVariables if err != nil { return nil, err } - if !res.(bool) { + res, _, err = types.Boolean.Convert(res) + if err != nil { + ctx.Warn(1292, err.Error()) + continue + } + if res.(int8) == 0 { continue } }