Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bump mysql version #2776

Merged
merged 1 commit into from
Dec 3, 2024
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
6 changes: 3 additions & 3 deletions enginetest/queries/queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -5346,7 +5346,7 @@ Select * from (
{
Query: "SELECT version()",
Expected: []sql.Row{
{string("8.0.11")},
{"8.0.23"},
},
},
{
Expand Down Expand Up @@ -5742,7 +5742,7 @@ Select * from (
{
Query: `SHOW VARIABLES WHERE Variable_name = 'version' || variable_name = 'autocommit'`,
Expected: []sql.Row{
{"autocommit", 1}, {"version", "8.0.11"},
{"autocommit", 1}, {"version", "8.0.23"},
},
},
{
Expand Down Expand Up @@ -5782,7 +5782,7 @@ Select * from (
{
Query: "SHOW VARIABLES LIKE 'VERSION'",
Expected: []sql.Row{
{"version", "8.0.11"},
{"version", "8.0.23"},
},
},
{
Expand Down
11 changes: 6 additions & 5 deletions sql/expression/function/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ import (
"github.com/dolthub/go-mysql-server/sql/types"
)

const mysqlVersion = "8.0.11"

// Version is a function that returns server version.
type Version string

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

// Eval implements the Expression interface.
func (f Version) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {
v, err := ctx.Session.GetSessionVariable(ctx, "version")
if err != nil {
return nil, err
}
if f == "" {
return mysqlVersion, nil
return v, nil
}

return fmt.Sprintf("%s-%s", mysqlVersion, string(f)), nil
return fmt.Sprintf("%s-%s", v, string(f)), nil
}
6 changes: 3 additions & 3 deletions sql/expression/function/version_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020-2021 Dolthub, Inc.
// Copyright 2020-2024 Dolthub, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -32,12 +32,12 @@ func TestNewVersion(t *testing.T) {

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

f, err = NewVersion("")()
require.NoError(err)

val, err = f.Eval(ctx, nil)
require.NoError(err)
require.Equal("8.0.11", val)
require.Equal("8.0.23", val)
}
2 changes: 1 addition & 1 deletion sql/variables/system_variables.go
Original file line number Diff line number Diff line change
Expand Up @@ -2941,7 +2941,7 @@ var systemVars = map[string]sql.SystemVariable{
Dynamic: false,
SetVarHintApplies: false,
Type: types.NewSystemStringType("version"),
Default: "8.0.11",
Default: "8.0.23",
},
"version_comment": &sql.MysqlSystemVariable{
Name: "version_comment",
Expand Down
Loading