[MDEV-31882] IFNULL('a', UUID()) returns an UUID Created: 2023-08-09 Updated: 2023-11-28 |
|
| Status: | Confirmed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | 10.7 |
| Fix Version/s: | 10.11, 11.0, 11.1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Claudio Friizziero | Assignee: | Alexander Barkov |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | ifnull | ||
| Environment: |
Centos |
||
| Description |
|
SELECT IFNULL('a', UUID()) returns an UUID, expected "a" i.e. SELECT IFNULL('a', RAND()) returns "a" |
| Comments |
| Comment by Claudio Friizziero [ 2023-08-09 ] | |||||||||||||||
|
also MariaDB 10.11.4 is affected | |||||||||||||||
| Comment by Sergei Golubchik [ 2023-08-11 ] | |||||||||||||||
|
Cf.
| |||||||||||||||
| Comment by Alexander Barkov [ 2023-08-16 ] | |||||||||||||||
|
INET6 demonstrates similar behavior:
| |||||||||||||||
| Comment by Alexander Barkov [ 2023-08-16 ] | |||||||||||||||
|
UUID and INET6 are implemented as strong data types (stronger than VARCHAR).
So
is actually evaluated as:
The result of CAST is NULL, because 'a' is not a valid UUID value. | |||||||||||||||
| Comment by Alexander Barkov [ 2023-08-16 ] | |||||||||||||||
|
During a discussion with serg, we had an idea that we could change the implicit CAST to convert wrong UUID values to zero UUID instead of NULL. However, this needs further studies. |