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

P2-[4.0 Bug Hunting]-[hex function]-missing padding zeros #17746

Closed
sre-bot opened this issue Jun 5, 2020 · 5 comments
Closed

P2-[4.0 Bug Hunting]-[hex function]-missing padding zeros #17746

sre-bot opened this issue Jun 5, 2020 · 5 comments
Labels
challenge-program duplicate Issues or pull requests already exists. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. severity/minor sig/execution SIG execution type/bug The issue is confirmed as a bug.

Comments

@sre-bot
Copy link
Contributor

sre-bot commented Jun 5, 2020

Description

Bug Hunter issue tidb-challenge-program/bug-hunting-issue#82


Bug Report

1. What did you do?

create table table1 (col1 binary(4));
insert into table1 values ('a'),('a ');
select hex(col1) from table1;
alter table table1 modify col1 binary(10);
select hex(col1) from table1;
insert into table1 values ('b'),('b ');
select hex(col1) from table1;

2. What did you expect to see?

mysql> create table table1 (col1 binary(4));
Query OK, 0 rows affected (0.02 sec)

mysql> insert into table1 values ('a'),('a ');
Query OK, 2 rows affected (0.01 sec)
Records: 2  Duplicates: 0  Warnings: 0

mysql> select hex(col1) from table1;
+-----------+
| hex(col1) |
+-----------+
| 61000000  |
| 61200000  |
+-----------+
2 rows in set (0.00 sec)

mysql> alter table table1 modify col1 binary(10);
Query OK, 2 rows affected (0.13 sec)
Records: 2  Duplicates: 0  Warnings: 0

mysql> select hex(col1) from table1;
+----------------------+
| hex(col1)            |
+----------------------+
| 61000000000000000000 |
| 61200000000000000000 |
+----------------------+
2 rows in set (0.00 sec)

mysql> insert into table1 values ('b'),('b ');
Query OK, 2 rows affected (0.00 sec)
Records: 2  Duplicates: 0  Warnings: 0

mysql> select hex(col1) from table1;
+----------------------+
| hex(col1)            |
+----------------------+
| 61000000000000000000 |
| 61200000000000000000 |
| 62000000000000000000 |
| 62200000000000000000 |
+----------------------+
4 rows in set (0.00 sec)

3. What did you see instead?

mysql> create table table1 (col1 binary(4));
Query OK, 0 rows affected (0.01 sec)

mysql> insert into table1 values ('a'),('a ');
Query OK, 2 rows affected (0.00 sec)
Records: 2  Duplicates: 0  Warnings: 0

mysql> select hex(col1) from table1;
+-----------+
| hex(col1) |
+-----------+
| 61000000  |
| 61200000  |
+-----------+
2 rows in set (0.00 sec)

mysql> alter table table1 modify col1 binary(10);
Query OK, 0 rows affected (0.01 sec)

mysql> select hex(col1) from table1;
+-----------+
| hex(col1) |
+-----------+
| 61000000  |
| 61200000  |
+-----------+
2 rows in set (0.00 sec)

mysql> insert into table1 values ('b'),('b ');
Query OK, 2 rows affected (0.00 sec)
Records: 2  Duplicates: 0  Warnings: 0

mysql> select hex(col1) from table1;
+----------------------+
| hex(col1)            |
+----------------------+
| 61000000             |
| 61200000             |
| 62000000000000000000 |
| 62200000000000000000 |
+----------------------+
4 rows in set (0.00 sec)

4. What version of TiDB are you using? (tidb-server -V or run select tidb_version(); on TiDB)

Reproducible on master branch:

commit 0d33a845766733fbb9e40dae8b7bf38fb0d3498b (HEAD -> master, origin/master, origin/HEAD)
Author: Zhuomin(Charming) Liu <lzmhhh123@gmail.com>
Date:   Wed May 20 19:54:37 2020 +0800

select tidb_version();

mysql> select tidb_version();
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version()                                                                                                                                                                                                                           |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: None
Edition: None
Git Commit Hash: None
Git Branch: None
UTC Build Time: None
GoVersion: go1.13.4
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

SIG slack channel

#sig-exec

Score

  • 300

Mentor

@sre-bot sre-bot added the type/bug The issue is confirmed as a bug. label Jun 5, 2020
@djshow832 djshow832 added the sig/execution SIG execution label Jun 5, 2020
@lzmhhh123 lzmhhh123 added challenge-program help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. labels Oct 30, 2020
@ghost
Copy link

ghost commented Nov 18, 2020

Related to #3644

@ou-bing
Copy link
Contributor

ou-bing commented Dec 7, 2020

/pick-up

@ti-challenge-bot
Copy link

Pick up success.

@ti-challenge-bot
Copy link

@ou-bing You did not submit PR within 7 days, so give up automatically.

@ti-challenge-bot ti-challenge-bot bot removed the picked label Dec 14, 2020
@wjhuang2016 wjhuang2016 added the duplicate Issues or pull requests already exists. label Jan 5, 2021
@wjhuang2016
Copy link
Member

Duplicate with #3644

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
challenge-program duplicate Issues or pull requests already exists. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. severity/minor sig/execution SIG execution type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

6 participants