[MDEV-9333] Inconsistency when copying from INT to ENUM Created: 2015-12-28 Updated: 2019-11-18 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | OTHER |
| Affects Version/s: | 5.5, 10.0, 10.1, 10.2 |
| Fix Version/s: | 10.2 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Alexander Barkov | Assignee: | Alexander Barkov |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Epic Link: | Data type cleanups |
| Description |
|
In this script:
copying is done using val_int() method of the field "a", which returns 2 and then further converts to ENUM value[2], which is '3'. So the script returns:
The same behavior is demonstrated in this script:
Now if I use ALTER:
it goes through val_str() of the field "a" which returns string '2', so the result is:
All three cases should return the same result. |
| Comments |
| Comment by Brian Evans [ 2016-05-20 ] | ||||||||||||||||||||||||||
|
I see a regression in the treatment of enums and ints in general here. create table mariadb_bug ( i int primary key, bug enum('0','1') NOT NULL DEFAULT '0' );
| ||||||||||||||||||||||||||
| Comment by Brian Evans [ 2016-05-20 ] | ||||||||||||||||||||||||||
|
Interestingly enough: MySQL 5.5.48:
|