Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
10.6.22
-
Unexpected results
-
Incorrect handling of null values on join conditions.
-
Q3/2025 Maintenance
Description
When populating the structure spl_opt_info for a TABLE, and evaluating a key_field for inclusion in spl_opt_info->added_key_fields, the null_rejecting attribute may be incorrectly set.
Our example from the test case
select STRAIGHT_JOIN count(*) FROM t1 tc |
INNER JOIN |
(
|
SELECT a, b, c, max(d) maxd FROM t1 |
GROUP BY a, b, c |
) c ON tc.a = c.a AND tc.b = c.b AND tc.c <=> c.c |
LEFT JOIN |
(
|
SELECT a, b, c, max(d) umaxd FROM t1 |
WHERE e = 'Y' |
GROUP BY a, b, c |
) c2 ON tc.a = c2.a AND tc.b = c2.b AND tc.c <=> c2.c |
WHERE tc.d < c.maxd AND NOT tc.d <=> c2.umaxd |
Originally, this null_rejecting was assumed to be TRUE, then it was changed
Item *real= key_field->val->real_item();
|
if ((real->type() == Item::FIELD_ITEM) && |
((Item_field*)real)->field->maybe_null())
|
added_key_field->null_rejecting= true; |
else |
added_key_field->null_rejecting= false; |
which also incorrectly assumed that the added key field depended on whether the field was able to set to null.
In the above query, for the derived table c2, we do not want this attribute to be null rejecting for key usage related to our join conditions, and we do not want equality conditions pushed into this derived table during a lateral join.
Attachments
Issue Links
- is part of
-
MDEV-36948 DELETE derived table query
-
- In Progress
-
- relates to
-
MDEV-37230 Incorrect handling of NULL join conditions when using split-materialized
-
- Closed
-
-
MDEV-37407 Wrong result with LATERAL DERIVED, for 10.11
-
- Closed
-