Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Duplicate
-
10.11.19, 13.1.1
-
Unexpected results
-
Wrong results with interval function pushed into derived table
-
Q4/2026 Server Maintenance
Description
INTERVAL() pushed into a materialized derived table gives a wrong result
Item_func_interval keeps Item_row *row as an alias of args[0] and evaluates through it. Item_func_or_sum::deep_copy() copies args[0] but the copy's row still points at the original row, whose fields are the outer select's columns of the derived table. The transformed copy prints correctly but evaluates the wrong items.
create table t1 (a int, b int); insert into t1 values (1,10),(5,20),(9,30); |
select * from (select a, b from t1 group by a, b) d where interval(d.a, 3, 7) = 1; |
-- returns no rows; with condition_pushdown_for_derived=off it returns 5,20 |
Attachments
Issue Links
- duplicates
-
MDEV-36295 INTERVAL function returns inconsistent results when used in a WHERE clause
-
- In Progress
-
- relates to
-
MDEV-41251 Wrong result with split materialized query
-
- In Progress
-