1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

bugfix: join a=b where cast(a as type_of_b) can produce NULL

optimizer implicitly assumed that if `a` in `a=b` is not NULL,
then it's safe to convert `a` to the type of `b` and search the
result in the index(b).

which is not always the case, as converting a non-null value
to a different type might produce NULL. And searching for NULL
in the index might find NULL there, so NULL will be equal to NULL,
making `a=b` behave as if it was `a<=>b`
This commit is contained in:
Sergei Golubchik
2023-07-05 21:51:52 +02:00
parent ef84f8137b
commit 1570c6e3e0
4 changed files with 363 additions and 5 deletions

View File

@ -1698,7 +1698,7 @@ Subquery_cache_miss 18
show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 32
Handler_read_key 29
Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
@ -1763,7 +1763,7 @@ Subquery_cache_miss 10
show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 13
Handler_read_key 12
Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0