[MDEV-10599] UNION / UNION ALL redefines tinyint(1) to tinyint(4) Created: 2016-08-19 Updated: 2023-04-27 |
|
| Status: | Confirmed |
| Project: | MariaDB Server |
| Component/s: | Data types |
| Affects Version/s: | 5.5, 10.0, 10.1, 10.2, 10.3 |
| Fix Version/s: | 10.4 |
| Type: | Bug | Priority: | Major |
| Reporter: | Uli Korn | Assignee: | Alexander Barkov |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | upstream | ||
| Description |
|
Using UNION and UNION ALL redefines datatypes from tinyint(1) to tinyint(4). How to do:
It occurs when opening the select, so it affects "select", "create table ... select", "creates view ... as select", .... |
| Comments |
| Comment by Elena Stepanova [ 2016-08-26 ] | |||||||||
|
5.5-10.2 and MySQL 5.5-5.7 are affected. | |||||||||
| Comment by Alexander Barkov [ 2017-10-06 ] | |||||||||
|
The same behavior is reproduced with INT(5) :
Notice, mixing INT(5) + INT(5) for UNION create an INT(11) column. | |||||||||
| Comment by Alexander Barkov [ 2017-10-06 ] | |||||||||
|
When mixing data types, we could preserve the length, and instead of:
return the following data types:
It will be easier to do in MariaDB-10.3, which introduced a more convenient way to handle data types. |