From de9562450c8d6921c117c9f1b11c8c173b8cc0b3 Mon Sep 17 00:00:00 2001 From: AilinKid <314806019@qq.com> Date: Fri, 24 Jul 2020 11:22:18 +0800 Subject: [PATCH 1/5] . Signed-off-by: AilinKid <314806019@qq.com> --- parser.go | 4 ++++ parser.y | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/parser.go b/parser.go index bed389ba6..711d21391 100644 --- a/parser.go +++ b/parser.go @@ -16538,6 +16538,10 @@ yynewstate: // TODO: check flen 0 x := types.NewFieldType(yyS[yypt-2].item.(byte)) x.Flen = yyS[yypt-1].item.(int) + if x.Flen != 0 { + yylex.AppendError(yylex.Errorf("Integer display width is deprecated and will be removed in a future release.")) + parser.lastErrorAsWarn() + } for _, o := range yyS[yypt-0].item.([]*ast.TypeOpt) { if o.IsUnsigned { x.Flag |= mysql.UnsignedFlag diff --git a/parser.y b/parser.y index b3ce3acbd..981cb5ae8 100644 --- a/parser.y +++ b/parser.y @@ -9634,6 +9634,10 @@ NumericType: // TODO: check flen 0 x := types.NewFieldType($1.(byte)) x.Flen = $2.(int) + if x.Flen != 0 { + yylex.AppendError(yylex.Errorf("Integer display width is deprecated and will be removed in a future release.")) + parser.lastErrorAsWarn() + } for _, o := range $3.([]*ast.TypeOpt) { if o.IsUnsigned { x.Flag |= mysql.UnsignedFlag From 85144ca69e8ba7d0b3d8ddc04e304ac3160ed335 Mon Sep 17 00:00:00 2001 From: AilinKid <314806019@qq.com> Date: Fri, 24 Jul 2020 12:04:33 +0800 Subject: [PATCH 2/5] . Signed-off-by: AilinKid <314806019@qq.com> --- yy_parser.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/yy_parser.go b/yy_parser.go index bab5f86a7..63764c47e 100644 --- a/yy_parser.go +++ b/yy_parser.go @@ -49,6 +49,8 @@ var ( ErrUnknownAlterAlgorithm = terror.ClassParser.New(mysql.ErrUnknownAlterAlgorithm, mysql.MySQLErrName[mysql.ErrUnknownAlterAlgorithm]) // ErrWrongValue returns for wrong value ErrWrongValue = terror.ClassParser.New(mysql.ErrWrongValue, mysql.MySQLErrName[mysql.ErrWrongValue]) + // ErrWarnDeprecatedSyntaxNoReplacement return when the syntax was deprecated and there is no replacement. + ErrWarnDeprecatedSyntaxNoReplacement = terror.ClassParser.New(mysql.ErrWarnDeprecatedSyntaxNoReplacement, mysql.MySQLErrName[mysql.ErrWarnDeprecatedSyntaxNoReplacement]) // SpecFieldPattern special result field pattern SpecFieldPattern = regexp.MustCompile(`(\/\*!(M?[0-9]{5,6})?|\*\/)`) specCodeStart = regexp.MustCompile(`^\/\*!(M?[0-9]{5,6})?[ \t]*`) From ef701ed8d88a0ad0cf00c66b37d78e5a2e3ba126 Mon Sep 17 00:00:00 2001 From: AilinKid <314806019@qq.com> Date: Fri, 24 Jul 2020 13:12:51 +0800 Subject: [PATCH 3/5] . Signed-off-by: AilinKid <314806019@qq.com> --- yy_parser.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/yy_parser.go b/yy_parser.go index 63764c47e..24ccb7dc0 100644 --- a/yy_parser.go +++ b/yy_parser.go @@ -51,6 +51,8 @@ var ( ErrWrongValue = terror.ClassParser.New(mysql.ErrWrongValue, mysql.MySQLErrName[mysql.ErrWrongValue]) // ErrWarnDeprecatedSyntaxNoReplacement return when the syntax was deprecated and there is no replacement. ErrWarnDeprecatedSyntaxNoReplacement = terror.ClassParser.New(mysql.ErrWarnDeprecatedSyntaxNoReplacement, mysql.MySQLErrName[mysql.ErrWarnDeprecatedSyntaxNoReplacement]) + // ErrWarnDeprecatedIntegerDisplayWidth share the same code 1681, and it will be returned when length is specified in integer. + ErrWarnDeprecatedIntegerDisplayWidth = terror.ClassParser.New(mysql.ErrWarnDeprecatedSyntaxNoReplacement, "Integer display width is deprecated and will be removed in a future release.") // SpecFieldPattern special result field pattern SpecFieldPattern = regexp.MustCompile(`(\/\*!(M?[0-9]{5,6})?|\*\/)`) specCodeStart = regexp.MustCompile(`^\/\*!(M?[0-9]{5,6})?[ \t]*`) From ea17501c167bd9f91fc5585d9f4d58fdc8d611e2 Mon Sep 17 00:00:00 2001 From: AilinKid <314806019@qq.com> Date: Fri, 24 Jul 2020 13:24:34 +0800 Subject: [PATCH 4/5] . Signed-off-by: AilinKid <314806019@qq.com> --- parser.go | 2 +- parser.y | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/parser.go b/parser.go index 711d21391..de4a73fe2 100644 --- a/parser.go +++ b/parser.go @@ -16538,7 +16538,7 @@ yynewstate: // TODO: check flen 0 x := types.NewFieldType(yyS[yypt-2].item.(byte)) x.Flen = yyS[yypt-1].item.(int) - if x.Flen != 0 { + if yyS[yypt-1].item.(int) != 0 { yylex.AppendError(yylex.Errorf("Integer display width is deprecated and will be removed in a future release.")) parser.lastErrorAsWarn() } diff --git a/parser.y b/parser.y index 981cb5ae8..50965ecde 100644 --- a/parser.y +++ b/parser.y @@ -9634,7 +9634,7 @@ NumericType: // TODO: check flen 0 x := types.NewFieldType($1.(byte)) x.Flen = $2.(int) - if x.Flen != 0 { + if $2.(int) != 0 { yylex.AppendError(yylex.Errorf("Integer display width is deprecated and will be removed in a future release.")) parser.lastErrorAsWarn() } From 47fa7bc0ef8ea6244c80eaf710bb0ed9d207966c Mon Sep 17 00:00:00 2001 From: AilinKid <314806019@qq.com> Date: Fri, 24 Jul 2020 13:28:13 +0800 Subject: [PATCH 5/5] . Signed-off-by: AilinKid <314806019@qq.com> --- parser.go | 2 +- parser.y | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/parser.go b/parser.go index de4a73fe2..c3d4ad44a 100644 --- a/parser.go +++ b/parser.go @@ -16538,7 +16538,7 @@ yynewstate: // TODO: check flen 0 x := types.NewFieldType(yyS[yypt-2].item.(byte)) x.Flen = yyS[yypt-1].item.(int) - if yyS[yypt-1].item.(int) != 0 { + if yyS[yypt-1].item.(int) != types.UnspecifiedLength { yylex.AppendError(yylex.Errorf("Integer display width is deprecated and will be removed in a future release.")) parser.lastErrorAsWarn() } diff --git a/parser.y b/parser.y index 50965ecde..7cfe5140d 100644 --- a/parser.y +++ b/parser.y @@ -9634,7 +9634,7 @@ NumericType: // TODO: check flen 0 x := types.NewFieldType($1.(byte)) x.Flen = $2.(int) - if $2.(int) != 0 { + if $2.(int) != types.UnspecifiedLength { yylex.AppendError(yylex.Errorf("Integer display width is deprecated and will be removed in a future release.")) parser.lastErrorAsWarn() }