Skip to content

Commit

Permalink
This is an automated cherry-pick of pingcap#49524
Browse files Browse the repository at this point in the history
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
  • Loading branch information
jiyfhust authored and ti-chi-bot committed Jan 11, 2024
1 parent 061a7da commit fa8e2d6
Show file tree
Hide file tree
Showing 9 changed files with 1,320 additions and 33 deletions.
6 changes: 5 additions & 1 deletion executor/infoschema_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,10 +423,14 @@ func (e *memtableRetriever) setDataForVariablesInfo(ctx sessionctx.Context) erro
if sv.IsNoop {
isNoop = "YES"
}
defVal := sv.Value
if sv.HasGlobalScope() {
defVal = variable.GlobalSystemVariableInitialValue(sv.Name, defVal)
}
row := types.MakeDatums(
sv.Name, // VARIABLE_NAME
sv.Scope.String(), // VARIABLE_SCOPE
sv.Value, // DEFAULT_VALUE
defVal, // DEFAULT_VALUE
currentVal, // CURRENT_VALUE
sv.MinValue, // MIN_VALUE
sv.MaxValue, // MAX_VALUE
Expand Down
3 changes: 2 additions & 1 deletion executor/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,8 @@ func (e *SetExecutor) getVarValue(ctx context.Context, v *expression.VarAssignme
// to the compiled-in MySQL default value, use the DEFAULT keyword.
// See http://dev.mysql.com/doc/refman/5.7/en/set-statement.html
if sysVar != nil {
return sysVar.Value, nil
defVal := variable.GlobalSystemVariableInitialValue(sysVar.Name, sysVar.Value)
return defVal, nil
}
return e.ctx.GetSessionVars().GetGlobalSystemVar(ctx, v.Name)
}
Expand Down
Loading

0 comments on commit fa8e2d6

Please sign in to comment.