From 33af5832917d8f60f33a3b5e5e4adbf38583d9f2 Mon Sep 17 00:00:00 2001 From: chagelo Date: Sat, 5 Oct 2024 18:33:07 +0800 Subject: [PATCH] pkg/expression: fix errors setting date and time precision match mysql ref pingcap/tidb#56451 --- errors.toml | 4 +- pkg/errno/errname.go | 2 +- pkg/expression/builtin_time.go | 57 +++++++++--------- pkg/expression/builtin_time_vec.go | 30 +++++----- pkg/parser/mysql/errname.go | 2 +- pkg/util/misc.go | 8 +-- .../r/expression/builtin.result | 56 +++++++++++++++++- .../integrationtest/r/expression/cast.result | 10 ++-- .../integrationtest/t/expression/builtin.test | 58 ++++++++++++++++++- 9 files changed, 170 insertions(+), 57 deletions(-) diff --git a/errors.toml b/errors.toml index b30f404faa03a..f3c7ae991964f 100644 --- a/errors.toml +++ b/errors.toml @@ -2018,7 +2018,7 @@ Division by 0 ["expression:1426"] error = ''' -Too big precision %d specified for column '%-.192s'. Maximum is %d. +Too-big precision %d specified for '%-.192s'. Maximum is %d. ''' ["expression:1582"] @@ -3288,7 +3288,7 @@ Too big scale %d specified for column '%-.192s'. Maximum is %d. ["types:1426"] error = ''' -Too big precision %d specified for column '%-.192s'. Maximum is %d. +Too-big precision %d specified for '%-.192s'. Maximum is %d. ''' ["types:1427"] diff --git a/pkg/errno/errname.go b/pkg/errno/errname.go index c9a9b21736495..3259373293505 100644 --- a/pkg/errno/errname.go +++ b/pkg/errno/errname.go @@ -432,7 +432,7 @@ var MySQLErrName = map[uint16]*mysql.ErrMessage{ ErrNoDefaultForViewField: mysql.Message("Field of view '%-.192s.%-.192s' underlying table doesn't have a default value", nil), ErrSpNoRecursion: mysql.Message("Recursive stored functions and triggers are not allowed.", nil), ErrTooBigScale: mysql.Message("Too big scale %d specified for column '%-.192s'. Maximum is %d.", nil), - ErrTooBigPrecision: mysql.Message("Too big precision %d specified for column '%-.192s'. Maximum is %d.", nil), + ErrTooBigPrecision: mysql.Message("Too-big precision %d specified for '%-.192s'. Maximum is %d.", nil), ErrMBiggerThanD: mysql.Message("For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column '%-.192s').", nil), ErrWrongLockOfSystemTable: mysql.Message("You can't combine write-locking of system tables with other tables or lock types", nil), ErrConnectToForeignDataSource: mysql.Message("Unable to connect to foreign data source: %.64s", nil), diff --git a/pkg/expression/builtin_time.go b/pkg/expression/builtin_time.go index 4100f705d63ad..05cb663b9ae6d 100644 --- a/pkg/expression/builtin_time.go +++ b/pkg/expression/builtin_time.go @@ -38,6 +38,7 @@ import ( "github.com/pingcap/tidb/pkg/parser/terror" "github.com/pingcap/tidb/pkg/sessionctx/stmtctx" "github.com/pingcap/tidb/pkg/types" + "github.com/pingcap/tidb/pkg/util" "github.com/pingcap/tidb/pkg/util/chunk" "github.com/pingcap/tidb/pkg/util/logutil" "github.com/pingcap/tidb/pkg/util/mathutil" @@ -2013,7 +2014,7 @@ func (c *sysDateFunctionClass) getFunction(ctx BuildContext, args []Expression) if err := c.verifyArgs(args); err != nil { return nil, err } - fsp, err := getFspByIntArg(ctx, args) + fsp, err := getFspByIntArg(ctx, args, c.funcName) if err != nil { return nil, err } @@ -2138,7 +2139,7 @@ func (c *currentTimeFunctionClass) getFunction(ctx BuildContext, args []Expressi return nil, err } - fsp, err := getFspByIntArg(ctx, args) + fsp, err := getFspByIntArg(ctx, args, c.funcName) if err != nil { return nil, err } @@ -2383,7 +2384,7 @@ func (c *utcTimestampFunctionClass) getFunction(ctx BuildContext, args []Express return nil, err } - fsp, err := getFspByIntArg(ctx, args) + fsp, err := getFspByIntArg(ctx, args, c.funcName) if err != nil { return nil, err } @@ -2424,19 +2425,20 @@ func (b *builtinUTCTimestampWithArgSig) Clone() builtinFunc { // evalTime evals UTC_TIMESTAMP(fsp). // See https://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html#function_utc-timestamp func (b *builtinUTCTimestampWithArgSig) evalTime(ctx EvalContext, row chunk.Row) (types.Time, bool, error) { - num, isNull, err := b.args[0].EvalInt(ctx, row) + fsp, isNull, err := b.args[0].EvalInt(ctx, row) if err != nil { return types.ZeroTime, true, err } - if !isNull && num > int64(types.MaxFsp) { - return types.ZeroTime, true, errors.Errorf("Too-big precision %v specified for 'utc_timestamp'. Maximum is %v", num, types.MaxFsp) - } - if !isNull && num < int64(types.MinFsp) { - return types.ZeroTime, true, errors.Errorf("Invalid negative %d specified, must in [0, 6]", num) + if !isNull { + if fsp > math.MaxInt32 || fsp < types.MinFsp { + return types.ZeroTime, true, types.ErrSyntax.GenWithStack(util.SyntaxErrorPrefix) + } else if fsp > types.MaxFsp { + return types.ZeroTime, true, types.ErrTooBigPrecision.GenWithStackByArgs(fsp, "utc_timestamp", types.MaxFsp) + } } - result, isNull, err := evalUTCTimestampWithFsp(ctx, int(num)) + result, isNull, err := evalUTCTimestampWithFsp(ctx, int(fsp)) return result, isNull, err } @@ -2474,7 +2476,7 @@ func (c *nowFunctionClass) getFunction(ctx BuildContext, args []Expression) (bui return nil, err } - fsp, err := getFspByIntArg(ctx, args) + fsp, err := getFspByIntArg(ctx, args, c.funcName) if err != nil { return nil, err } @@ -2553,10 +2555,10 @@ func (b *builtinNowWithArgSig) evalTime(ctx EvalContext, row chunk.Row) (types.T if isNull { fsp = 0 - } else if fsp > int64(types.MaxFsp) { - return types.ZeroTime, true, errors.Errorf("Too-big precision %v specified for 'now'. Maximum is %v", fsp, types.MaxFsp) - } else if fsp < int64(types.MinFsp) { - return types.ZeroTime, true, errors.Errorf("Invalid negative %d specified, must in [0, 6]", fsp) + } else if fsp > math.MaxInt32 || fsp < types.MinFsp { + return types.ZeroTime, true, types.ErrSyntax.GenWithStack(util.SyntaxErrorPrefix) + } else if fsp > types.MaxFsp { + return types.ZeroTime, true, types.ErrTooBigPrecision.GenWithStackByArgs(fsp, "now", types.MaxFsp) } result, isNull, err := evalNowWithFsp(ctx, int(fsp)) @@ -6455,7 +6457,7 @@ func (c *utcTimeFunctionClass) getFunction(ctx BuildContext, args []Expression) if err != nil { return nil, err } - fsp, err := getFspByIntArg(ctx, args) + fsp, err := getFspByIntArg(ctx, args, c.funcName) if err != nil { return nil, err } @@ -6513,12 +6515,13 @@ func (b *builtinUTCTimeWithArgSig) evalDuration(ctx EvalContext, row chunk.Row) if isNull || err != nil { return types.Duration{}, isNull, err } - if fsp > int64(types.MaxFsp) { - return types.Duration{}, true, errors.Errorf("Too-big precision %v specified for 'utc_time'. Maximum is %v", fsp, types.MaxFsp) - } - if fsp < int64(types.MinFsp) { - return types.Duration{}, true, errors.Errorf("Invalid negative %d specified, must in [0, 6]", fsp) + + if fsp > math.MaxInt32 || fsp < types.MinFsp { + return types.Duration{}, true, types.ErrSyntax.GenWithStack(util.SyntaxErrorPrefix) + } else if fsp > types.MaxFsp { + return types.Duration{}, true, types.ErrTooBigPrecision.GenWithStackByArgs(fsp, "utc_time", types.MaxFsp) } + nowTs, err := getStmtTimestamp(ctx) if err != nil { return types.Duration{}, true, err @@ -6804,7 +6807,7 @@ func calAppropriateTime(minTime, maxTime, minSafeTime time.Time) time.Time { } // getFspByIntArg is used by some time functions to get the result fsp. If len(expr) == 0, then the fsp is not explicit set, use 0 as default. -func getFspByIntArg(ctx BuildContext, exps []Expression) (int, error) { +func getFspByIntArg(ctx BuildContext, exps []Expression, funcName string) (int, error) { if len(exps) == 0 { return 0, nil } @@ -6818,12 +6821,12 @@ func getFspByIntArg(ctx BuildContext, exps []Expression) (int, error) { // If isNULL, it may be a bug of parser. Return 0 to be compatible with old version. return 0, err } - if fsp > int64(types.MaxFsp) { - return 0, errors.Errorf("Too-big precision %v specified for 'curtime'. Maximum is %v", fsp, types.MaxFsp) - } else if fsp < int64(types.MinFsp) { - return 0, errors.Errorf("Invalid negative %d specified, must in [0, 6]", fsp) + + if fsp > math.MaxInt32 || fsp < types.MinFsp { + return 0, types.ErrSyntax.GenWithStack(util.SyntaxErrorPrefix) + } else if fsp > types.MaxFsp { + return 0, types.ErrTooBigPrecision.GenWithStackByArgs(fsp, funcName, types.MaxFsp) } - return int(fsp), nil } // Should no happen. But our tests may generate non-constant input. return 0, nil diff --git a/pkg/expression/builtin_time_vec.go b/pkg/expression/builtin_time_vec.go index b965952a7108e..2d943ca36447d 100644 --- a/pkg/expression/builtin_time_vec.go +++ b/pkg/expression/builtin_time_vec.go @@ -21,10 +21,10 @@ import ( "strings" "time" - "github.com/pingcap/errors" "github.com/pingcap/tidb/pkg/parser/mysql" "github.com/pingcap/tidb/pkg/parser/terror" "github.com/pingcap/tidb/pkg/types" + "github.com/pingcap/tidb/pkg/util" "github.com/pingcap/tidb/pkg/util/chunk" "github.com/tikv/client-go/v2/oracle" ) @@ -404,12 +404,12 @@ func (b *builtinUTCTimeWithArgSig) vecEvalDuration(ctx EvalContext, input *chunk if result.IsNull(i) { continue } - fsp := i64s[i] - if fsp > int64(types.MaxFsp) { - return errors.Errorf("Too-big precision %v specified for 'utc_time'. Maximum is %v", fsp, types.MaxFsp) + if i64s[i] > math.MaxInt32 || i64s[i] < types.MinFsp { + return types.ErrSyntax.GenWithStack(util.SyntaxErrorPrefix) } - if fsp < int64(types.MinFsp) { - return errors.Errorf("Invalid negative %d specified, must in [0, 6]", fsp) + fsp := i64s[i] + if fsp > types.MaxFsp { + return types.ErrTooBigPrecision.GenWithStackByArgs(fsp, "utc_time", types.MaxFsp) } res, _, err := types.ParseDuration(tc, utc, int(fsp)) if err != nil { @@ -546,11 +546,11 @@ func (b *builtinNowWithArgSig) vecEvalTime(ctx EvalContext, input *chunk.Chunk, for i := 0; i < n; i++ { fsp := 0 if !bufFsp.IsNull(i) { - if fsps[i] > int64(types.MaxFsp) { - return errors.Errorf("Too-big precision %v specified for 'now'. Maximum is %v", fsps[i], types.MaxFsp) + if fsps[i] > math.MaxInt32 || fsps[i] < types.MinFsp { + return types.ErrSyntax.GenWithStack(util.SyntaxErrorPrefix) } - if fsps[i] < int64(types.MinFsp) { - return errors.Errorf("Invalid negative %d specified, must in [0, 6]", fsps[i]) + if fsps[i] > types.MaxFsp { + return types.ErrTooBigPrecision.GenWithStackByArgs(fsps[i], "now", types.MaxFsp) } fsp = int(fsps[i]) } @@ -1407,12 +1407,12 @@ func (b *builtinUTCTimestampWithArgSig) vecEvalTime(ctx EvalContext, input *chun if result.IsNull(i) { continue } - fsp := i64s[i] - if fsp > int64(types.MaxFsp) { - return errors.Errorf("Too-big precision %v specified for 'utc_timestamp'. Maximum is %v", fsp, types.MaxFsp) + if i64s[i] > math.MaxInt32 || i64s[i] < types.MinFsp { + return types.ErrSyntax.GenWithStack(util.SyntaxErrorPrefix) } - if fsp < int64(types.MinFsp) { - return errors.Errorf("Invalid negative %d specified, must in [0, 6]", fsp) + fsp := i64s[i] + if fsp > types.MaxFsp { + return types.ErrTooBigPrecision.GenWithStackByArgs(fsp, "utc_timestamp", types.MaxFsp) } res, isNull, err := evalUTCTimestampWithFsp(ctx, int(fsp)) if err != nil { diff --git a/pkg/parser/mysql/errname.go b/pkg/parser/mysql/errname.go index c105a8446f23c..f757f825da43e 100644 --- a/pkg/parser/mysql/errname.go +++ b/pkg/parser/mysql/errname.go @@ -454,7 +454,7 @@ var MySQLErrName = map[uint16]*ErrMessage{ ErrNoDefaultForViewField: Message("Field of view '%-.192s.%-.192s' underlying table doesn't have a default value", nil), ErrSpNoRecursion: Message("Recursive stored functions and triggers are not allowed.", nil), ErrTooBigScale: Message("Too big scale %d specified for column '%-.192s'. Maximum is %d.", nil), - ErrTooBigPrecision: Message("Too big precision %d specified for column '%-.192s'. Maximum is %d.", nil), + ErrTooBigPrecision: Message("Too-big precision %d specified for '%-.192s'. Maximum is %d.", nil), ErrMBiggerThanD: Message("For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column '%-.192s').", nil), ErrWrongLockOfSystemTable: Message("You can't combine write-locking of system tables with other tables or lock types", nil), ErrConnectToForeignDataSource: Message("Unable to connect to foreign data source: %.64s", nil), diff --git a/pkg/util/misc.go b/pkg/util/misc.go index 2c0d2ae16429e..a907600010a87 100644 --- a/pkg/util/misc.go +++ b/pkg/util/misc.go @@ -140,8 +140,8 @@ func HasCancelled(ctx context.Context) (cancel bool) { } const ( - // syntaxErrorPrefix is the common prefix for SQL syntax error in TiDB. - syntaxErrorPrefix = "You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use" + // SyntaxErrorPrefix is the common prefix for SQL syntax error in TiDB. + SyntaxErrorPrefix = "You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use" ) // SyntaxError converts parser error to TiDB's syntax error. @@ -159,7 +159,7 @@ func SyntaxError(err error) error { } } - return parser.ErrParse.GenWithStackByArgs(syntaxErrorPrefix, err.Error()) + return parser.ErrParse.GenWithStackByArgs(SyntaxErrorPrefix, err.Error()) } // SyntaxWarn converts parser warn to TiDB's syntax warn. @@ -175,7 +175,7 @@ func SyntaxWarn(err error) error { return err } - return parser.ErrParse.FastGenByArgs(syntaxErrorPrefix, err.Error()) + return parser.ErrParse.FastGenByArgs(SyntaxErrorPrefix, err.Error()) } var ( diff --git a/tests/integrationtest/r/expression/builtin.result b/tests/integrationtest/r/expression/builtin.result index 010b4458469b2..e5869d051cf08 100644 --- a/tests/integrationtest/r/expression/builtin.result +++ b/tests/integrationtest/r/expression/builtin.result @@ -1181,7 +1181,7 @@ Error 1264 (22003): Out of range value for column 'a' at row 1 select cast(12.1 as decimal(3, 4)); Error 1427 (42000): For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column '12.1'). SELECT CAST(1 AS DATETIME(7)); -Error 1426 (42000): Too big precision 7 specified for column 'CAST'. Maximum is 6. +Error 1426 (42000): Too-big precision 7 specified for 'CAST'. Maximum is 6. select unhex('4D7953514C'); unhex('4D7953514C') MySQL @@ -3339,3 +3339,57 @@ b SELECT MID('abc',2); MID('abc',2) bc +SELECT CURRENT_TIME(-1); +Error 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 21 near "-1);" +SELECT CURRENT_TIME(2147483647); +Error 1426 (42000): Too-big precision 2147483647 specified for 'current_time'. Maximum is 6. +SELECT CURRENT_TIME(2147483648); +Error 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use +SELECT CURRENT_TIMESTAMP(-1); +Error 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 26 near "-1);" +SELECT CURRENT_TIMESTAMP(2147483647); +Error 1426 (42000): Too-big precision 2147483647 specified for 'current_timestamp'. Maximum is 6. +SELECT CURRENT_TIMESTAMP(2147483648); +Error 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use +SELECT CURTIME(-1); +Error 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 16 near "-1);" +SELECT CURTIME(2147483647); +Error 1426 (42000): Too-big precision 2147483647 specified for 'curtime'. Maximum is 6. +SELECT CURTIME(2147483648); +Error 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use +SELECT LOCALTIME(-1); +Error 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 18 near "-1);" +SELECT LOCALTIME(2147483647); +Error 1426 (42000): Too-big precision 2147483647 specified for 'localtime'. Maximum is 6. +SELECT LOCALTIME(2147483648); +Error 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use +SELECT LOCALTIMESTAMP(-1); +Error 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 23 near "-1);" +SELECT LOCALTIMESTAMP(2147483647); +Error 1426 (42000): Too-big precision 2147483647 specified for 'localtimestamp'. Maximum is 6. +SELECT LOCALTIMESTAMP(2147483648); +Error 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use +SELECT NOW(-1); +Error 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use +SELECT NOW(2147483647); +Error 1426 (42000): Too-big precision 2147483647 specified for 'now'. Maximum is 6. +SELECT NOW(2147483648); +Error 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use +SELECT SYSDATE(-1); +Error 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 16 near "-1);" +SELECT SYSDATE(2147483647); +Error 1426 (42000): Too-big precision 2147483647 specified for 'sysdate'. Maximum is 6. +SELECT SYSDATE(2147483648); +Error 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use +SELECT UTC_TIME(-1); +Error 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 17 near "-1);" +SELECT UTC_TIME(2147483647); +Error 1426 (42000): Too-big precision 2147483647 specified for 'utc_time'. Maximum is 6. +SELECT UTC_TIME(2147483648); +Error 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use +SELECT UTC_TIMESTAMP(-1); +Error 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 22 near "-1);" +SELECT UTC_TIMESTAMP(2147483647); +Error 1426 (42000): Too-big precision 2147483647 specified for 'utc_timestamp'. Maximum is 6. +SELECT UTC_TIMESTAMP(2147483648); +Error 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use diff --git a/tests/integrationtest/r/expression/cast.result b/tests/integrationtest/r/expression/cast.result index a919c1e53ccf2..1d237ebfd87e0 100644 --- a/tests/integrationtest/r/expression/cast.result +++ b/tests/integrationtest/r/expression/cast.result @@ -69,15 +69,15 @@ select cast(col1 as time), cast(col2 as time), cast(col3 as time), cast(col4 as cast(col1 as time) cast(col2 as time) cast(col3 as time) cast(col4 as time) cast(col5 as time) NULL NULL NULL NULL NULL select cast(col1 as time(31)) from t where col1 is null; -Error 1426 (42000): Too big precision 31 specified for column 'CAST'. Maximum is 6. +Error 1426 (42000): Too-big precision 31 specified for 'CAST'. Maximum is 6. select cast(col2 as time(31)) from t where col1 is null; -Error 1426 (42000): Too big precision 31 specified for column 'CAST'. Maximum is 6. +Error 1426 (42000): Too-big precision 31 specified for 'CAST'. Maximum is 6. select cast(col3 as time(31)) from t where col1 is null; -Error 1426 (42000): Too big precision 31 specified for column 'CAST'. Maximum is 6. +Error 1426 (42000): Too-big precision 31 specified for 'CAST'. Maximum is 6. select cast(col4 as time(31)) from t where col1 is null; -Error 1426 (42000): Too big precision 31 specified for column 'CAST'. Maximum is 6. +Error 1426 (42000): Too-big precision 31 specified for 'CAST'. Maximum is 6. select cast(col5 as time(31)) from t where col1 is null; -Error 1426 (42000): Too big precision 31 specified for column 'CAST'. Maximum is 6. +Error 1426 (42000): Too-big precision 31 specified for 'CAST'. Maximum is 6. drop table if exists t; create table t(a varchar(50)); insert into t values ('2020-01-01 12:00:00.123456 +0600 PST'); diff --git a/tests/integrationtest/t/expression/builtin.test b/tests/integrationtest/t/expression/builtin.test index 79da88a70a6a2..f9dde0906c81c 100644 --- a/tests/integrationtest/t/expression/builtin.test +++ b/tests/integrationtest/t/expression/builtin.test @@ -1579,6 +1579,62 @@ select hex(r) as r0 from (select ELT(2, col1, col2) as r from t3 group by ELT(2, select hex(r) as r0 from (select distinct ELT(2, col1, col2) as r from t3) as t order by r0; drop table t, t2, t3; -# Issue $52420 +# Issue #52420 SELECT MID('abc',2,1); SELECT MID('abc',2); + +# Issue #56451 +-- error 1064 +SELECT CURRENT_TIME(-1); +-- error 1426 +SELECT CURRENT_TIME(2147483647); +-- error 1064 +SELECT CURRENT_TIME(2147483648); +-- error 1064 +SELECT CURRENT_TIMESTAMP(-1); +-- error 1426 +SELECT CURRENT_TIMESTAMP(2147483647); +-- error 1064 +SELECT CURRENT_TIMESTAMP(2147483648); +-- error 1064 +SELECT CURTIME(-1); +-- error 1426 +SELECT CURTIME(2147483647); +-- error 1064 +SELECT CURTIME(2147483648); +-- error 1064 +SELECT LOCALTIME(-1); +-- error 1426 +SELECT LOCALTIME(2147483647); +-- error 1064 +SELECT LOCALTIME(2147483648); +-- error 1064 +SELECT LOCALTIMESTAMP(-1); +-- error 1426 +SELECT LOCALTIMESTAMP(2147483647); +-- error 1064 +SELECT LOCALTIMESTAMP(2147483648); +-- error 1064 +SELECT NOW(-1); +-- error 1426 +SELECT NOW(2147483647); +-- error 1064 +SELECT NOW(2147483648); +-- error 1064 +SELECT SYSDATE(-1); +-- error 1426 +SELECT SYSDATE(2147483647); +-- error 1064 +SELECT SYSDATE(2147483648); +-- error 1064 +SELECT UTC_TIME(-1); +-- error 1426 +SELECT UTC_TIME(2147483647); +-- error 1064 +SELECT UTC_TIME(2147483648); +-- error 1064 +SELECT UTC_TIMESTAMP(-1); +-- error 1426 +SELECT UTC_TIMESTAMP(2147483647); +-- error 1064 +SELECT UTC_TIMESTAMP(2147483648);