util: rewrite parser warings for integer display width#18775
Conversation
Codecov Report
@@ Coverage Diff @@
## master #18775 +/- ##
===========================================
Coverage 79.3811% 79.3811%
===========================================
Files 546 546
Lines 148219 148219
===========================================
Hits 117658 117658
Misses 21078 21078
Partials 9483 9483 |
|
To clarify, this is a MySQL 8.0 compatible behavior, not a MySQL 5.7 one: mysql [localhost:5731] {msandbox} (test) > CREATE TABLE t1 (id int(10) not null);
Query OK, 0 rows affected (0.02 sec)
mysql [localhost:5731] {msandbox} (test) > SHOW WARNINGS;
Empty set (0.00 sec)
..
mysql [localhost:8021] {msandbox} (test) > CREATE TABLE t1 (id int(10) not null);
Query OK, 0 rows affected, 1 warning (0.03 sec)
mysql [localhost:8021] {msandbox} (test) > show warnings;
+---------+------+------------------------------------------------------------------------------+
| Level | Code | Message |
+---------+------+------------------------------------------------------------------------------+
| Warning | 1681 | Integer display width is deprecated and will be removed in a future release. |
+---------+------+------------------------------------------------------------------------------+
1 row in set (0.00 sec)Looking at this patch, it looks like it doesn't modify There is still a use-case in MySQL to use integer display width because of See also: #17682 |
So that means we should fix the integer display length in the output of |
|
I wanna do it in another PR. |
|
/run-unit-test |
I think it is important that a CREATE TABLE -> SHOW CREATE TABLE -> CREATE TABLE doesn't produce warnings. Perhaps in terms of simplifying PRs:
What do you think? (The actual setting name may need some discussion. There is nothing else called |
Sounds great |
c90282c to
7a14aa6
Compare
|
PTAL @tangenta @djshow832 @zimulala |
Signed-off-by: AilinKid <314806019@qq.com>
Signed-off-by: AilinKid <314806019@qq.com>
Signed-off-by: AilinKid <314806019@qq.com>
5f926f5 to
8f8d881
Compare
Signed-off-by: AilinKid <314806019@qq.com>
786ffe4 to
f9c7037
Compare
|
/run-check_dev_2 |
|
/run-unit-test |
There was a problem hiding this comment.
| func (s *testSerialDBSuite) TestCreateTableWithIntegerLengthWaring(c *C) { | |
| func (s *testSerialDBSuite) TestCreateTableWithIntegerLengthWarning(c *C) { |
|
/run-all-tests |
|
/run-common-test |
|
/run-integration-ddl-test |
|
/run-common-test |
|
/run-integration-ddl-test |
Signed-off-by: AilinKid 314806019@qq.com
What problem does this PR solve?
The linked Parser: pingcap/parser#939
Problem Summary: For integerType:
if they are followed with
(num)to specify the length, it should have the warningsWhat is changed and how it works?
How it Works:
mark the warings in parser, rewrite the parser with terror class {errcode 1681, errmsg "xxx"} in TiDB
Check List
Tests
Release note