From c37977c87d1d26a81ea44275d853e636532e2a16 Mon Sep 17 00:00:00 2001 From: "dlenev@brandersnatch.localdomain" <> Date: Mon, 22 Nov 2004 13:05:10 +0300 Subject: Fix for bug #6462 "Same request on same data returns different results." a.k.a. "Proper cleanup of subqueries is missing for SET and DO statements". (Version #2 with after-review fixes). To perform proper cleanup for statements that can contain subqueries but don't have main select we must call free_undelaid_joins(). --- mysql-test/r/subselect.result | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'mysql-test/r/subselect.result') diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 32d482f5a32..53b92fe50f1 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -1990,3 +1990,18 @@ ac 700 NULL drop tables t1,t2; +create table t1 (a int not null, b int not null, c int, primary key (a,b)); +insert into t1 values (1,1,1), (2,2,2), (3,3,3); +set @b:= 0; +explain select sum(a) from t1 where b > @b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL PRIMARY 8 NULL 3 Using where; Using index +set @a:= (select sum(a) from t1 where b > @b); +explain select a from t1 where c=2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where +do @a:= (select sum(a) from t1 where b > @b); +explain select a from t1 where c=2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where +drop table t1; -- cgit v1.2.1