[MDEV-29491] InnoDB: Strange printed result on SELECT DISTINCT col_bit ... ORDER BY col_bit Created: 2022-09-07 Updated: 2022-09-08 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Data types |
| Affects Version/s: | 10.5.18, 10.6.10 |
| Fix Version/s: | 10.5, 10.6 |
| Type: | Bug | Priority: | Major |
| Reporter: | Matthias Leich | Assignee: | Alexander Barkov |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
|
| Comments |
| Comment by Alexander Barkov [ 2022-09-08 ] | |||||||||||||
|
BIT was implemented in an unfortunate way. It has hybrid nature. In some context it looks like INT, in some context it looks like BINARY.
A possible workaround is to cast BIT to a number, either implicitly through a numeric expression, or explicitly through CAST:
The manual at https://mariadb.com/kb/en/bit/ also suggests to use HEX(), OCT() or BIN() functions to see a BIT column value. Strictly, this is not a bug. It was intentionally implemented this way. It could be displayed as:
Displaying it as BINARY(NBYTES) represending the underlying array of bytes looks meaningless. | |||||||||||||
| Comment by Matthias Leich [ 2022-09-08 ] | |||||||||||||
|
|