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

*: fix a timezone data race which may cause wrong row data #41146

Merged
merged 12 commits into from
Feb 8, 2023
2 changes: 1 addition & 1 deletion br/pkg/task/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ func ParseTSString(ts string, tzCheck bool) (uint64, error) {
return 0, errors.Errorf("must set timezone when using datetime format ts, e.g. '2018-05-11 01:42:23+0800'")
}
}
t, err := types.ParseTime(sc, ts, mysql.TypeTimestamp, types.MaxFsp)
t, err := types.ParseTime(sc, ts, mysql.TypeTimestamp, types.MaxFsp, nil)
if err != nil {
return 0, errors.Trace(err)
}
Expand Down
6 changes: 3 additions & 3 deletions ddl/ddl_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,7 @@ func checkColumnDefaultValue(ctx sessionctx.Context, col *table.Column, value in
if value != nil && ctx.GetSessionVars().SQLMode.HasNoZeroDateMode() &&
ctx.GetSessionVars().SQLMode.HasStrictMode() && types.IsTypeTime(col.GetType()) {
if vv, ok := value.(string); ok {
timeValue, err := expression.GetTimeValue(ctx, vv, col.GetType(), col.GetDecimal())
timeValue, err := expression.GetTimeValue(ctx, vv, col.GetType(), col.GetDecimal(), nil)
if err != nil {
return hasDefaultValue, value, errors.Trace(err)
}
Expand All @@ -973,7 +973,7 @@ func convertTimestampDefaultValToUTC(ctx sessionctx.Context, defaultVal interfac
}
if vv, ok := defaultVal.(string); ok {
if vv != types.ZeroDatetimeStr && !strings.EqualFold(vv, ast.CurrentTimestamp) {
t, err := types.ParseTime(ctx.GetSessionVars().StmtCtx, vv, col.GetType(), col.GetDecimal())
t, err := types.ParseTime(ctx.GetSessionVars().StmtCtx, vv, col.GetType(), col.GetDecimal(), nil)
if err != nil {
return defaultVal, errors.Trace(err)
}
Expand Down Expand Up @@ -1224,7 +1224,7 @@ func getDefaultValue(ctx sessionctx.Context, col *table.Column, option *ast.Colu
}

if tp == mysql.TypeTimestamp || tp == mysql.TypeDatetime || tp == mysql.TypeDate {
vd, err := expression.GetTimeValue(ctx, option.Expr, tp, fsp)
vd, err := expression.GetTimeValue(ctx, option.Expr, tp, fsp, nil)
value := vd.GetValue()
if err != nil {
return nil, false, dbterror.ErrInvalidDefaultValue.GenWithStackByArgs(col.Name.O)
Expand Down
2 changes: 1 addition & 1 deletion executor/brie.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ func (bq *brieQueue) clearTask(sc *stmtctx.StatementContext) {

func (b *executorBuilder) parseTSString(ts string) (uint64, error) {
sc := &stmtctx.StatementContext{TimeZone: b.ctx.GetSessionVars().Location()}
t, err := types.ParseTime(sc, ts, mysql.TypeTimestamp, types.MaxFsp)
t, err := types.ParseTime(sc, ts, mysql.TypeTimestamp, types.MaxFsp, nil)
if err != nil {
return 0, err
}
Expand Down
2 changes: 1 addition & 1 deletion executor/executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2489,7 +2489,7 @@ func TestTimestampDefaultValueTimeZone(t *testing.T) {
tk.MustExec(`set time_zone = '+00:00'`)
timeIn0 := tk.MustQuery("select b from t").Rows()[0][0]
require.NotEqual(t, timeIn8, timeIn0)
datumTimeIn8, err := expression.GetTimeValue(tk.Session(), timeIn8, mysql.TypeTimestamp, 0)
datumTimeIn8, err := expression.GetTimeValue(tk.Session(), timeIn8, mysql.TypeTimestamp, 0, nil)
require.NoError(t, err)
tIn8To0 := datumTimeIn8.GetMysqlTime()
timeZoneIn8, err := time.LoadLocation("Asia/Shanghai")
Expand Down
10 changes: 5 additions & 5 deletions executor/inspection_result_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ func TestInspectionResult(t *testing.T) {
}

func parseTime(t *testing.T, se session.Session, str string) types.Time {
time, err := types.ParseTime(se.GetSessionVars().StmtCtx, str, mysql.TypeDatetime, types.MaxFsp)
time, err := types.ParseTime(se.GetSessionVars().StmtCtx, str, mysql.TypeDatetime, types.MaxFsp, nil)
require.NoError(t, err)
return time
}
Expand Down Expand Up @@ -338,7 +338,7 @@ func TestThresholdCheckInspection2(t *testing.T) {
tk := testkit.NewTestKit(t, store)
tk.MustExec("use test")
datetime := func(s string) types.Time {
time, err := types.ParseTime(tk.Session().GetSessionVars().StmtCtx, s, mysql.TypeDatetime, types.MaxFsp)
time, err := types.ParseTime(tk.Session().GetSessionVars().StmtCtx, s, mysql.TypeDatetime, types.MaxFsp, nil)
require.NoError(t, err)
return time
}
Expand Down Expand Up @@ -421,7 +421,7 @@ func TestThresholdCheckInspection3(t *testing.T) {
tk := testkit.NewTestKit(t, store)
tk.MustExec("use test")
datetime := func(s string) types.Time {
time, err := types.ParseTime(tk.Session().GetSessionVars().StmtCtx, s, mysql.TypeDatetime, types.MaxFsp)
time, err := types.ParseTime(tk.Session().GetSessionVars().StmtCtx, s, mysql.TypeDatetime, types.MaxFsp, nil)
require.NoError(t, err)
return time
}
Expand Down Expand Up @@ -628,7 +628,7 @@ func TestNodeLoadInspection(t *testing.T) {
tk := testkit.NewTestKit(t, store)
tk.MustExec("use test")
datetime := func(s string) types.Time {
time, err := types.ParseTime(tk.Session().GetSessionVars().StmtCtx, s, mysql.TypeDatetime, types.MaxFsp)
time, err := types.ParseTime(tk.Session().GetSessionVars().StmtCtx, s, mysql.TypeDatetime, types.MaxFsp, nil)
require.NoError(t, err)
return time
}
Expand Down Expand Up @@ -704,7 +704,7 @@ func TestConfigCheckOfStorageBlockCacheSize(t *testing.T) {
tk := testkit.NewTestKit(t, store)
tk.MustExec("use test")
datetime := func(s string) types.Time {
time, err := types.ParseTime(tk.Session().GetSessionVars().StmtCtx, s, mysql.TypeDatetime, types.MaxFsp)
time, err := types.ParseTime(tk.Session().GetSessionVars().StmtCtx, s, mysql.TypeDatetime, types.MaxFsp, nil)
require.NoError(t, err)
return time
}
Expand Down
2 changes: 1 addition & 1 deletion executor/inspection_summary_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func TestInspectionSummary(t *testing.T) {
defer func() { require.NoError(t, failpoint.Disable(fpName)) }()

datetime := func(s string) types.Time {
time, err := types.ParseTime(tk.Session().GetSessionVars().StmtCtx, s, mysql.TypeDatetime, types.MaxFsp)
time, err := types.ParseTime(tk.Session().GetSessionVars().StmtCtx, s, mysql.TypeDatetime, types.MaxFsp, nil)
require.NoError(t, err)
return time
}
Expand Down
2 changes: 1 addition & 1 deletion executor/write.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func updateRecord(ctx context.Context, sctx sessionctx.Context, h kv.Handle, old
// Fill values into on-update-now fields, only if they are really changed.
for i, col := range t.Cols() {
if mysql.HasOnUpdateNowFlag(col.GetFlag()) && !modified[i] && !onUpdateSpecified[i] {
if v, err := expression.GetTimeValue(sctx, strings.ToUpper(ast.CurrentTimestamp), col.GetType(), col.GetDecimal()); err == nil {
if v, err := expression.GetTimeValue(sctx, strings.ToUpper(ast.CurrentTimestamp), col.GetType(), col.GetDecimal(), nil); err == nil {
newData[i] = v
modified[i] = true
} else {
Expand Down
4 changes: 2 additions & 2 deletions expression/builtin_cast.go
Original file line number Diff line number Diff line change
Expand Up @@ -1444,7 +1444,7 @@ func (b *builtinCastStringAsTimeSig) evalTime(row chunk.Row) (res types.Time, is
return res, isNull, err
}
sc := b.ctx.GetSessionVars().StmtCtx
res, err = types.ParseTime(sc, val, b.tp.GetType(), b.tp.GetDecimal())
res, err = types.ParseTime(sc, val, b.tp.GetType(), b.tp.GetDecimal(), nil)
if err != nil {
return types.ZeroTime, true, handleInvalidTimeError(b.ctx, err)
}
Expand Down Expand Up @@ -1919,7 +1919,7 @@ func (b *builtinCastJSONAsTimeSig) evalTime(row chunk.Row) (res types.Time, isNu
return res, false, err
}
sc := b.ctx.GetSessionVars().StmtCtx
res, err = types.ParseTime(sc, s, b.tp.GetType(), b.tp.GetDecimal())
res, err = types.ParseTime(sc, s, b.tp.GetType(), b.tp.GetDecimal(), nil)
if err != nil {
return types.ZeroTime, true, handleInvalidTimeError(b.ctx, err)
}
Expand Down
4 changes: 2 additions & 2 deletions expression/builtin_cast_vec.go
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ func (b *builtinCastJSONAsTimeSig) vecEvalTime(input *chunk.Chunk, result *chunk
if err != nil {
return err
}
tm, err := types.ParseTime(stmtCtx, s, b.tp.GetType(), fsp)
tm, err := types.ParseTime(stmtCtx, s, b.tp.GetType(), fsp, nil)
if err != nil {
if err = handleInvalidTimeError(b.ctx, err); err != nil {
return err
Expand Down Expand Up @@ -1766,7 +1766,7 @@ func (b *builtinCastStringAsTimeSig) vecEvalTime(input *chunk.Chunk, result *chu
if result.IsNull(i) {
continue
}
tm, err := types.ParseTime(stmtCtx, buf.GetString(i), b.tp.GetType(), fsp)
tm, err := types.ParseTime(stmtCtx, buf.GetString(i), b.tp.GetType(), fsp, nil)
if err != nil {
if err = handleInvalidTimeError(b.ctx, err); err != nil {
return err
Expand Down
14 changes: 7 additions & 7 deletions expression/builtin_time.go
Original file line number Diff line number Diff line change
Expand Up @@ -2774,7 +2774,7 @@ func (du *baseDateArithmetical) getDateFromString(ctx sessionctx.Context, args [
}

sc := ctx.GetSessionVars().StmtCtx
date, err := types.ParseTime(sc, dateStr, dateTp, types.MaxFsp)
date, err := types.ParseTime(sc, dateStr, dateTp, types.MaxFsp, nil)
if err != nil {
err = handleInvalidTimeError(ctx, err)
if err != nil {
Expand Down Expand Up @@ -3184,7 +3184,7 @@ func (du *baseDateArithmetical) vecGetDateFromString(b *baseBuiltinFunc, input *
dateTp = mysql.TypeDatetime
}

date, err := types.ParseTime(sc, dateStr, dateTp, types.MaxFsp)
date, err := types.ParseTime(sc, dateStr, dateTp, types.MaxFsp, nil)
if err != nil {
err = handleInvalidTimeError(b.ctx, err)
if err != nil {
Expand Down Expand Up @@ -4348,7 +4348,7 @@ func (b *builtinTimestamp1ArgSig) evalTime(row chunk.Row) (types.Time, bool, err
if b.isFloat {
tm, err = types.ParseTimeFromFloatString(sc, s, mysql.TypeDatetime, types.GetFsp(s))
} else {
tm, err = types.ParseTime(sc, s, mysql.TypeDatetime, types.GetFsp(s))
tm, err = types.ParseTime(sc, s, mysql.TypeDatetime, types.GetFsp(s), nil)
}
if err != nil {
return types.ZeroTime, true, handleInvalidTimeError(b.ctx, err)
Expand Down Expand Up @@ -4380,7 +4380,7 @@ func (b *builtinTimestamp2ArgsSig) evalTime(row chunk.Row) (types.Time, bool, er
if b.isFloat {
tm, err = types.ParseTimeFromFloatString(sc, arg0, mysql.TypeDatetime, types.GetFsp(arg0))
} else {
tm, err = types.ParseTime(sc, arg0, mysql.TypeDatetime, types.GetFsp(arg0))
tm, err = types.ParseTime(sc, arg0, mysql.TypeDatetime, types.GetFsp(arg0), nil)
}
if err != nil {
return types.ZeroTime, true, handleInvalidTimeError(b.ctx, err)
Expand Down Expand Up @@ -4431,7 +4431,7 @@ func (c *timestampLiteralFunctionClass) getFunction(ctx sessionctx.Context, args
if !timestampPattern.MatchString(str) {
return nil, types.ErrWrongValue.GenWithStackByArgs(types.DateTimeStr, str)
}
tm, err := types.ParseTime(ctx.GetSessionVars().StmtCtx, str, mysql.TypeDatetime, types.GetFsp(str))
tm, err := types.ParseTime(ctx.GetSessionVars().StmtCtx, str, mysql.TypeDatetime, types.GetFsp(str), nil)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -4539,7 +4539,7 @@ func isDuration(str string) bool {

// strDatetimeAddDuration adds duration to datetime string, returns a string value.
func strDatetimeAddDuration(sc *stmtctx.StatementContext, d string, arg1 types.Duration) (result string, isNull bool, err error) {
arg0, err := types.ParseTime(sc, d, mysql.TypeDatetime, types.MaxFsp)
arg0, err := types.ParseTime(sc, d, mysql.TypeDatetime, types.MaxFsp, nil)
if err != nil {
// Return a warning regardless of the sql_mode, this is compatible with MySQL.
sc.AppendWarning(err)
Expand Down Expand Up @@ -4576,7 +4576,7 @@ func strDurationAddDuration(sc *stmtctx.StatementContext, d string, arg1 types.D

// strDatetimeSubDuration subtracts duration from datetime string, returns a string value.
func strDatetimeSubDuration(sc *stmtctx.StatementContext, d string, arg1 types.Duration) (result string, isNull bool, err error) {
arg0, err := types.ParseTime(sc, d, mysql.TypeDatetime, types.MaxFsp)
arg0, err := types.ParseTime(sc, d, mysql.TypeDatetime, types.MaxFsp, nil)
if err != nil {
// Return a warning regardless of the sql_mode, this is compatible with MySQL.
sc.AppendWarning(err)
Expand Down
4 changes: 2 additions & 2 deletions expression/builtin_time_vec.go
Original file line number Diff line number Diff line change
Expand Up @@ -2660,7 +2660,7 @@ func (b *builtinTimestamp1ArgSig) vecEvalTime(input *chunk.Chunk, result *chunk.
if b.isFloat {
tm, err = types.ParseTimeFromFloatString(sc, s, mysql.TypeDatetime, types.GetFsp(s))
} else {
tm, err = types.ParseTime(sc, s, mysql.TypeDatetime, types.GetFsp(s))
tm, err = types.ParseTime(sc, s, mysql.TypeDatetime, types.GetFsp(s), nil)
}
if err != nil {
if err = handleInvalidTimeError(b.ctx, err); err != nil {
Expand Down Expand Up @@ -2713,7 +2713,7 @@ func (b *builtinTimestamp2ArgsSig) vecEvalTime(input *chunk.Chunk, result *chunk
if b.isFloat {
tm, err = types.ParseTimeFromFloatString(sc, arg0, mysql.TypeDatetime, types.GetFsp(arg0))
} else {
tm, err = types.ParseTime(sc, arg0, mysql.TypeDatetime, types.GetFsp(arg0))
tm, err = types.ParseTime(sc, arg0, mysql.TypeDatetime, types.GetFsp(arg0), nil)
}
if err != nil {
if err = handleInvalidTimeError(b.ctx, err); err != nil {
Expand Down
6 changes: 3 additions & 3 deletions expression/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func getTimeCurrentTimeStamp(ctx sessionctx.Context, tp byte, fsp int) (t types.
}

// GetTimeValue gets the time value with type tp.
func GetTimeValue(ctx sessionctx.Context, v interface{}, tp byte, fsp int) (d types.Datum, err error) {
func GetTimeValue(ctx sessionctx.Context, v interface{}, tp byte, fsp int, explicitTz *time.Location) (d types.Datum, err error) {
tiancaiamao marked this conversation as resolved.
Show resolved Hide resolved
var value types.Time

sc := ctx.GetSessionVars().StmtCtx
Expand All @@ -99,15 +99,15 @@ func GetTimeValue(ctx sessionctx.Context, v interface{}, tp byte, fsp int) (d ty
value, err = types.ParseTimeFromNum(sc, 0, tp, fsp)
terror.Log(err)
} else {
value, err = types.ParseTime(sc, x, tp, fsp)
value, err = types.ParseTime(sc, x, tp, fsp, nil)
if err != nil {
return d, err
}
}
case *driver.ValueExpr:
switch x.Kind() {
case types.KindString:
value, err = types.ParseTime(sc, x.GetString(), tp, fsp)
value, err = types.ParseTime(sc, x.GetString(), tp, fsp, nil)
if err != nil {
return d, err
}
Expand Down
16 changes: 8 additions & 8 deletions expression/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (

func TestGetTimeValue(t *testing.T) {
ctx := mock.NewContext()
v, err := GetTimeValue(ctx, "2012-12-12 00:00:00", mysql.TypeTimestamp, types.MinFsp)
v, err := GetTimeValue(ctx, "2012-12-12 00:00:00", mysql.TypeTimestamp, types.MinFsp, nil)
require.NoError(t, err)

require.Equal(t, types.KindMysqlTime, v.Kind())
Expand All @@ -42,7 +42,7 @@ func TestGetTimeValue(t *testing.T) {
sessionVars := ctx.GetSessionVars()
err = sessionVars.SetSystemVar("timestamp", "0")
require.NoError(t, err)
v, err = GetTimeValue(ctx, "2012-12-12 00:00:00", mysql.TypeTimestamp, types.MinFsp)
v, err = GetTimeValue(ctx, "2012-12-12 00:00:00", mysql.TypeTimestamp, types.MinFsp, nil)
require.NoError(t, err)

require.Equal(t, types.KindMysqlTime, v.Kind())
Expand All @@ -51,7 +51,7 @@ func TestGetTimeValue(t *testing.T) {

err = sessionVars.SetSystemVar("timestamp", "0")
require.NoError(t, err)
v, err = GetTimeValue(ctx, "2012-12-12 00:00:00", mysql.TypeTimestamp, types.MinFsp)
v, err = GetTimeValue(ctx, "2012-12-12 00:00:00", mysql.TypeTimestamp, types.MinFsp, nil)
require.NoError(t, err)

require.Equal(t, types.KindMysqlTime, v.Kind())
Expand All @@ -60,7 +60,7 @@ func TestGetTimeValue(t *testing.T) {

err = sessionVars.SetSystemVar("timestamp", "")
require.Error(t, err, "Incorrect argument type to variable 'timestamp'")
v, err = GetTimeValue(ctx, "2012-12-12 00:00:00", mysql.TypeTimestamp, types.MinFsp)
v, err = GetTimeValue(ctx, "2012-12-12 00:00:00", mysql.TypeTimestamp, types.MinFsp, nil)
require.NoError(t, err)

require.Equal(t, types.KindMysqlTime, v.Kind())
Expand Down Expand Up @@ -98,7 +98,7 @@ func TestGetTimeValue(t *testing.T) {

for i, tbl := range tbls {
comment := fmt.Sprintf("expr: %d", i)
v, err := GetTimeValue(ctx, tbl.Expr, mysql.TypeTimestamp, types.MinFsp)
v, err := GetTimeValue(ctx, tbl.Expr, mysql.TypeTimestamp, types.MinFsp, nil)
require.NoError(t, err)

switch v.Kind() {
Expand All @@ -120,7 +120,7 @@ func TestGetTimeValue(t *testing.T) {
}

for _, tbl := range errTbl {
_, err := GetTimeValue(ctx, tbl.Expr, mysql.TypeTimestamp, types.MinFsp)
_, err := GetTimeValue(ctx, tbl.Expr, mysql.TypeTimestamp, types.MinFsp, nil)
require.Error(t, err)
}
}
Expand Down Expand Up @@ -163,7 +163,7 @@ func TestCurrentTimestampTimeZone(t *testing.T) {
require.NoError(t, err)
err = sessionVars.SetSystemVar("time_zone", "+00:00")
require.NoError(t, err)
v, err := GetTimeValue(ctx, ast.CurrentTimestamp, mysql.TypeTimestamp, types.MinFsp)
v, err := GetTimeValue(ctx, ast.CurrentTimestamp, mysql.TypeTimestamp, types.MinFsp, nil)
require.NoError(t, err)
require.EqualValues(t, types.NewTime(
types.FromDate(1970, 1, 1, 0, 20, 34, 0),
Expand All @@ -174,7 +174,7 @@ func TestCurrentTimestampTimeZone(t *testing.T) {
// would get different value.
err = sessionVars.SetSystemVar("time_zone", "+08:00")
require.NoError(t, err)
v, err = GetTimeValue(ctx, ast.CurrentTimestamp, mysql.TypeTimestamp, types.MinFsp)
v, err = GetTimeValue(ctx, ast.CurrentTimestamp, mysql.TypeTimestamp, types.MinFsp, nil)
require.NoError(t, err)
require.EqualValues(t, types.NewTime(
types.FromDate(1970, 1, 1, 8, 20, 34, 0),
Expand Down
2 changes: 1 addition & 1 deletion planner/core/expression_rewriter.go
Original file line number Diff line number Diff line change
Expand Up @@ -2117,7 +2117,7 @@ func (er *expressionRewriter) evalDefaultExpr(v *ast.DefaultExpr) {
var val *expression.Constant
switch {
case isCurrentTimestamp && (col.GetType() == mysql.TypeDatetime || col.GetType() == mysql.TypeTimestamp):
t, err := expression.GetTimeValue(er.sctx, ast.CurrentTimestamp, col.GetType(), col.GetDecimal())
t, err := expression.GetTimeValue(er.sctx, ast.CurrentTimestamp, col.GetType(), col.GetDecimal(), nil)
if err != nil {
return
}
Expand Down
2 changes: 1 addition & 1 deletion server/statistics_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func (sh StatsHistoryHandler) ServeHTTP(w http.ResponseWriter, req *http.Request
}

se.GetSessionVars().StmtCtx.TimeZone = time.Local
t, err := types.ParseTime(se.GetSessionVars().StmtCtx, params[pSnapshot], mysql.TypeTimestamp, 6)
t, err := types.ParseTime(se.GetSessionVars().StmtCtx, params[pSnapshot], mysql.TypeTimestamp, 6, nil)
if err != nil {
writeError(w, err)
return
Expand Down
2 changes: 1 addition & 1 deletion server/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func TestDumpTextValue(t *testing.T) {
require.NoError(t, err)
sc.TimeZone = losAngelesTz

time, err := types.ParseTime(sc, "2017-01-05 23:59:59.575601", mysql.TypeDatetime, 0)
time, err := types.ParseTime(sc, "2017-01-05 23:59:59.575601", mysql.TypeDatetime, 0, nil)
require.NoError(t, err)
d.SetMysqlTime(time)
columns[0].Type = mysql.TypeDatetime
Expand Down
4 changes: 2 additions & 2 deletions sessionctx/variable/varsutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ func parseTSFromNumberOrTime(s *SessionVars, sVal string) (uint64, error) {
return tso, nil
}

t, err := types.ParseTime(s.StmtCtx, sVal, mysql.TypeTimestamp, types.MaxFsp)
t, err := types.ParseTime(s.StmtCtx, sVal, mysql.TypeTimestamp, types.MaxFsp, nil)
if err != nil {
return 0, err
}
Expand All @@ -482,7 +482,7 @@ func setTxnReadTS(s *SessionVars, sVal string) error {
return nil
}

t, err := types.ParseTime(s.StmtCtx, sVal, mysql.TypeTimestamp, types.MaxFsp)
t, err := types.ParseTime(s.StmtCtx, sVal, mysql.TypeTimestamp, types.MaxFsp, nil)
if err != nil {
return err
}
Expand Down
Loading