1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-32555 wrong result with an index and a partially null-rejecting condition

ref->null_rejecting is a key_part_map. we need to check
the bit corresponding to the particular store_key.
Note that there are no store_key objects for const ref parts.
This commit is contained in:
Sergei Golubchik
2023-10-24 23:50:26 +02:00
parent d2a867cdf0
commit b9e210bbf3
4 changed files with 75 additions and 14 deletions

View File

@@ -26078,12 +26078,15 @@ cp_buffer_from_ref(THD *thd, TABLE *table, TABLE_REF *ref)
enum_check_fields org_count_cuted_fields= thd->count_cuted_fields;
MY_BITMAP *old_map= dbug_tmp_use_all_columns(table, &table->write_set);
bool result= 0;
key_part_map map= 1;
thd->count_cuted_fields= CHECK_FIELD_IGNORE;
for (store_key **copy=ref->key_copy ; *copy ; copy++)
for (store_key **copy=ref->key_copy ; *copy ; copy++, map <<= 1)
{
while (map & ref->const_ref_part_map) // skip const ref parts
map <<= 1; // no store_key objects for them
if ((*copy)->copy(thd) & 1 ||
(ref->null_rejecting && (*copy)->null_key))
((ref->null_rejecting & map) && (*copy)->null_key))
{
result= 1;
break;