Comment 3 for bug 777691

Revision history for this message
Timour Katchaounov (timour) wrote :

Test case that shows that the problem is in the order
of data - if a NULL result comes first, then we get wrong
result. Probably the recorded NULL result is not being
reset properly for the next row.

SET @@optimizer_switch='materialization=off,subquery_cache=off';

CREATE TABLE t1 ( f11 varchar(32)) ;
INSERT INTO t1 VALUES ('b'),('x');

CREATE TABLE t2 ( f2 int, f10 varchar(32)) ;
INSERT INTO t2 VALUES (1,'x');

SELECT t1.f11, ( SELECT MAX( f2 ) FROM t2 WHERE t2.f10 = t1.f11 ) FROM t1;