Myshiner opened a new issue #3311: tinyint(1) column type will result in a 
booleam value in the query data
URL: https://github.com/apache/incubator-shardingsphere/issues/3311
 
 
   Project: Sharding-proxy
   Version: v4.0.0-RC3
   
   ## Question
   when the table column type be set to tinyint(1), the query result set of 
this column will be set to '1'. but it's ok with tinyint(2) or tinyint(3).
   This bug seems to be issued in v3.1.0 and i was told that it will be 
resolved in the later version.
   
   mysql> desc test2;
   +-------+------------------+------+------+---------+----------------+
   | Field | Type             | Null | Key  | Default | Extra          |
   +-------+------------------+------+------+---------+----------------+
   | id    | int(10) unsigned | NO   | PRI  | NULL    | auto_increment |
   | ctype | **tinyint(1)**       | NO   |      | 0       |                |
   +-------+------------------+------+------+---------+----------------+
   
   mysql> insert into test2 values(1,1),(2,2),(3,0),(4,1),(5,2);
   Query OK, 5 rows affected (0.13 sec)
   
   In command line mode, no value will return.
   mysql> select * from test2;
   +------+-------+
   | id   | ctype |
   +------+-------+
   |    1 |      |
   |    2 |      |
   |    3 |       |
   |    4 |      |
   |    5 |      |
   +------+-------+
   5 rows in set (0.03 sec)
   
   In navicate query result, will get a booleam value except value '0'
   
![微信图片_20191017164947](https://user-images.githubusercontent.com/48242833/66993440-2aaf4600-f0fe-11e9-966f-8684d351aca2.png)
   
   when set to tinyint(2), the query result is ok.
   mysql> alter table test2 modify ctype tinyint(2) not null default 0 comment 
'类型';
   Query OK, 0 rows affected (0.06 sec)
   mysql> select * from test2;
   +------+-------+
   | id   | ctype |
   +------+-------+
   |    1 |     1 |
   |    2 |     2 |
   |    3 |     0 |
   |    4 |     1 |
   |    5 |     2 |
   +------+-------+
   5 rows in set (0.02 sec)
   mysql> 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to