[MDEV-15579] Crash in Item_field::used_tables() called by Item::derived_field_transformer_for_having Created: 2018-03-15  Updated: 2018-04-04  Resolved: 2018-04-03

Status: Closed
Project: MariaDB Server
Component/s: Optimizer
Affects Version/s: 10.2
Fix Version/s: 10.2.15, 10.3.6

Type: Bug Priority: Major
Reporter: Galina Shalygina (Inactive) Assignee: Galina Shalygina (Inactive)
Resolution: Fixed Votes: 0
Labels: None


 Description   

CREATE TABLE t1 (a INT, b INT, c INT);
CREATE TABLE t2 (d INT, e INT, f INT);
 
INSERT INTO t1 VALUES (1,1,66), (1,1,38), (3,3,66);
INSERT INTO t2 VALUES (1,1,66), (1,12,32), (3,3,66);

The query that fails uses equalities. One of these equalities should be pushed into the WHERE clause and the two others into the HAVING clause.

SELECT * 
FROM t2,
(
  SELECT a, b, max(c) AS max_c
  FROM t1
  GROUP BY a 
  HAVING max_c > 37
) AS v1
WHERE (v1.a=1) AND (v1.b=v1.a) AND 
             (v1.a=t2.e) AND (v1.max_c=66); 



 Comments   
Comment by Igor Babaev [ 2018-03-25 ]

Ok to push

Comment by Galina Shalygina (Inactive) [ 2018-04-03 ]

Pushed in 10.2

Generated at Thu Feb 08 08:22:27 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.