Skip to content

Commit 29d5096

Browse files
jycorJames Cor
andauthored
bumping mysql version (#2776)
Co-authored-by: James Cor <[email protected]>
1 parent 8a86c58 commit 29d5096

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

enginetest/queries/queries.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5346,7 +5346,7 @@ Select * from (
53465346
{
53475347
Query: "SELECT version()",
53485348
Expected: []sql.Row{
5349-
{string("8.0.11")},
5349+
{"8.0.23"},
53505350
},
53515351
},
53525352
{
@@ -5742,7 +5742,7 @@ Select * from (
57425742
{
57435743
Query: `SHOW VARIABLES WHERE Variable_name = 'version' || variable_name = 'autocommit'`,
57445744
Expected: []sql.Row{
5745-
{"autocommit", 1}, {"version", "8.0.11"},
5745+
{"autocommit", 1}, {"version", "8.0.23"},
57465746
},
57475747
},
57485748
{
@@ -5782,7 +5782,7 @@ Select * from (
57825782
{
57835783
Query: "SHOW VARIABLES LIKE 'VERSION'",
57845784
Expected: []sql.Row{
5785-
{"version", "8.0.11"},
5785+
{"version", "8.0.23"},
57865786
},
57875787
},
57885788
{

sql/expression/function/version.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ import (
2121
"github.com/dolthub/go-mysql-server/sql/types"
2222
)
2323

24-
const mysqlVersion = "8.0.11"
25-
2624
// Version is a function that returns server version.
2725
type Version string
2826

@@ -86,9 +84,12 @@ func (f Version) Children() []sql.Expression { return nil }
8684

8785
// Eval implements the Expression interface.
8886
func (f Version) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {
87+
v, err := ctx.Session.GetSessionVariable(ctx, "version")
88+
if err != nil {
89+
return nil, err
90+
}
8991
if f == "" {
90-
return mysqlVersion, nil
92+
return v, nil
9193
}
92-
93-
return fmt.Sprintf("%s-%s", mysqlVersion, string(f)), nil
94+
return fmt.Sprintf("%s-%s", v, string(f)), nil
9495
}

sql/expression/function/version_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2020-2021 Dolthub, Inc.
1+
// Copyright 2020-2024 Dolthub, Inc.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -32,12 +32,12 @@ func TestNewVersion(t *testing.T) {
3232

3333
val, err := f.Eval(ctx, nil)
3434
require.NoError(err)
35-
require.Equal("8.0.11-"+versionPostfix, val)
35+
require.Equal("8.0.23-"+versionPostfix, val)
3636

3737
f, err = NewVersion("")()
3838
require.NoError(err)
3939

4040
val, err = f.Eval(ctx, nil)
4141
require.NoError(err)
42-
require.Equal("8.0.11", val)
42+
require.Equal("8.0.23", val)
4343
}

sql/variables/system_variables.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2941,7 +2941,7 @@ var systemVars = map[string]sql.SystemVariable{
29412941
Dynamic: false,
29422942
SetVarHintApplies: false,
29432943
Type: types.NewSystemStringType("version"),
2944-
Default: "8.0.11",
2944+
Default: "8.0.23",
29452945
},
29462946
"version_comment": &sql.MysqlSystemVariable{
29472947
Name: "version_comment",

0 commit comments

Comments
 (0)