List:Commits« Previous MessageNext Message »
From:Roy Lyseng Date:June 10 2011 1:52pm
Subject:Re: bzr commit into mysql-trunk branch (jorgen.loland:3380) Bug#12608157
View as plain text  
Hi Jørgen,

thank you for a nice patch, the bugfix is approved.

Regards,
Roy

On 10.06.11 13.10, Jorgen Loland wrote:
> #At file:///export/home/jl208045/mysql/mysql-next-mr-opt-backporting-12608157/ based
> on revid:roy.lyseng@stripped
>
>   3380 Jorgen Loland	2011-06-10
>        Bug#12608157 - ASSERT IN FIELD_LONG::VAL_INT WHEN USING
>                       MEMORY ENGINE
>
>        Item_in_subselect does not have it's own implementation of
>        walk(), but rather inherits Item_subselect::walk(). This is a
>        problem because Item_in_subselect has Item *left_expression
>        which Item_subselect does not have.
>
>        Due to this, cond->walk() would not walk
>        Item_in_subselect::left_expression which resulted in an ASSERT
>        because the column in left_expression was not marked in the
>        read_set. The reason why memory storage engine was required
>        to trigger the bug is that with this engine, filesort does
>        not use addon_fields. In the case of engines like MyISAM and
>        InnoDB, the column not registered in the read set was found
>        during preparation of addon fields in register_used_fields().
>
>        The fix is to implement Item_in_subselect::walk() which calls
>        both left_expr->walk() and Item_subselect::walk().
>       @ mysql-test/include/subquery_sj.inc
>          Add test for BUG#12608157
>       @ mysql-test/r/subquery_sj_all.result
>          Add test for BUG#12608157
>       @ mysql-test/r/subquery_sj_all_jcl6.result
>          Add test for BUG#12608157
>       @ mysql-test/r/subquery_sj_all_jcl7.result
>          Add test for BUG#12608157
>       @ mysql-test/r/subquery_sj_dupsweed.result
>          Add test for BUG#12608157
>       @ mysql-test/r/subquery_sj_dupsweed_jcl6.result
>          Add test for BUG#12608157
>       @ mysql-test/r/subquery_sj_dupsweed_jcl7.result
>          Add test for BUG#12608157
>       @ mysql-test/r/subquery_sj_firstmatch.result
>          Add test for BUG#12608157
>       @ mysql-test/r/subquery_sj_firstmatch_jcl6.result
>          Add test for BUG#12608157
>       @ mysql-test/r/subquery_sj_firstmatch_jcl7.result
>          Add test for BUG#12608157
>       @ mysql-test/r/subquery_sj_loosescan.result
>          Add test for BUG#12608157
>       @ mysql-test/r/subquery_sj_loosescan_jcl6.result
>          Add test for BUG#12608157
>       @ mysql-test/r/subquery_sj_loosescan_jcl7.result
>          Add test for BUG#12608157
>       @ mysql-test/r/subquery_sj_mat.result
>          Add test for BUG#12608157
>       @ mysql-test/r/subquery_sj_mat_jcl6.result
>          Add test for BUG#12608157
>       @ mysql-test/r/subquery_sj_mat_jcl7.result
>          Add test for BUG#12608157
>       @ mysql-test/r/subquery_sj_mat_nosj.result
>          Add test for BUG#12608157
>       @ mysql-test/r/subquery_sj_none.result
>          Add test for BUG#12608157
>       @ mysql-test/r/subquery_sj_none_jcl6.result
>          Add test for BUG#12608157
>       @ mysql-test/r/subquery_sj_none_jcl7.result
>          Add test for BUG#12608157
>       @ sql/item_subselect.cc
>          Add Item_in_subselect::walk() and Item_subselect::walk_body()
>       @ sql/item_subselect.h
>          Add Item_in_subselect::walk() and Item_subselect::walk_body()
>
>      modified:
>        mysql-test/include/subquery_sj.inc
>        mysql-test/r/subquery_sj_all.result
>        mysql-test/r/subquery_sj_all_jcl6.result
>        mysql-test/r/subquery_sj_all_jcl7.result
>        mysql-test/r/subquery_sj_dupsweed.result
>        mysql-test/r/subquery_sj_dupsweed_jcl6.result
>        mysql-test/r/subquery_sj_dupsweed_jcl7.result
>        mysql-test/r/subquery_sj_firstmatch.result
>        mysql-test/r/subquery_sj_firstmatch_jcl6.result
>        mysql-test/r/subquery_sj_firstmatch_jcl7.result
>        mysql-test/r/subquery_sj_loosescan.result
>        mysql-test/r/subquery_sj_loosescan_jcl6.result
>        mysql-test/r/subquery_sj_loosescan_jcl7.result
>        mysql-test/r/subquery_sj_mat.result
>        mysql-test/r/subquery_sj_mat_jcl6.result
>        mysql-test/r/subquery_sj_mat_jcl7.result
>        mysql-test/r/subquery_sj_mat_nosj.result
>        mysql-test/r/subquery_sj_none.result
>        mysql-test/r/subquery_sj_none_jcl6.result
>        mysql-test/r/subquery_sj_none_jcl7.result
>        sql/item_subselect.cc
>        sql/item_subselect.h
> === modified file 'mysql-test/include/subquery_sj.inc'
> --- a/mysql-test/include/subquery_sj.inc	2011-03-17 08:00:10 +0000
> +++ b/mysql-test/include/subquery_sj.inc	2011-06-10 11:10:38 +0000
> @@ -3540,3 +3540,25 @@ ORDER BY a;
>
>   DROP TABLE t1;
>   DROP VIEW v1;
> +
> +--echo #
> +--echo # Bug#12608157: ASSERT IN FIELD_LONG::VAL_INT WHEN USING MEMORY ENGINE
> +--echo #
> +
> +CREATE TABLE t1 (i1 int);
> +INSERT INTO t1 VALUES (1);
> +
> +CREATE TABLE t2 (i1 int, i2 int) ENGINE=memory;
> +INSERT INTO t2 VALUES (1, 2),(7, 3);
> +
> +SELECT GRANDPARENT1.i1
> +FROM t2 AS GRANDPARENT1
> +WHERE GRANDPARENT1.i2
> +      IN ( SELECT PARENT1.i2
> +           FROM t2 AS PARENT1 JOIN t1 AS PARENT2 ON (PARENT1.i1 = PARENT2.i1)
> +           WHERE
> +              GRANDPARENT1.i1 IN ( SELECT CHILD1.i1 FROM t2 AS CHILD1 )
> +           ORDER BY PARENT1.i1)
> +ORDER BY GRANDPARENT1.i2 ;
> +
> +DROP TABLE t1,t2;
>
> === modified file 'mysql-test/r/subquery_sj_all.result'
> --- a/mysql-test/r/subquery_sj_all.result	2011-06-08 13:24:56 +0000
> +++ b/mysql-test/r/subquery_sj_all.result	2011-06-10 11:10:38 +0000
> @@ -5429,4 +5429,23 @@ a
>   0
>   DROP TABLE t1;
>   DROP VIEW v1;
> +#
> +# Bug#12608157: ASSERT IN FIELD_LONG::VAL_INT WHEN USING MEMORY ENGINE
> +#
> +CREATE TABLE t1 (i1 int);
> +INSERT INTO t1 VALUES (1);
> +CREATE TABLE t2 (i1 int, i2 int) ENGINE=memory;
> +INSERT INTO t2 VALUES (1, 2),(7, 3);
> +SELECT GRANDPARENT1.i1
> +FROM t2 AS GRANDPARENT1
> +WHERE GRANDPARENT1.i2
> +IN ( SELECT PARENT1.i2
> +FROM t2 AS PARENT1 JOIN t1 AS PARENT2 ON (PARENT1.i1 = PARENT2.i1)
> +WHERE
> +GRANDPARENT1.i1 IN ( SELECT CHILD1.i1 FROM t2 AS CHILD1 )
> +ORDER BY PARENT1.i1)
> +ORDER BY GRANDPARENT1.i2 ;
> +i1
> +1
> +DROP TABLE t1,t2;
>   set optimizer_switch=default;
>
> === modified file 'mysql-test/r/subquery_sj_all_jcl6.result'
> --- a/mysql-test/r/subquery_sj_all_jcl6.result	2011-06-08 13:24:56 +0000
> +++ b/mysql-test/r/subquery_sj_all_jcl6.result	2011-06-10 11:10:38 +0000
> @@ -5433,5 +5433,24 @@ a
>   0
>   DROP TABLE t1;
>   DROP VIEW v1;
> +#
> +# Bug#12608157: ASSERT IN FIELD_LONG::VAL_INT WHEN USING MEMORY ENGINE
> +#
> +CREATE TABLE t1 (i1 int);
> +INSERT INTO t1 VALUES (1);
> +CREATE TABLE t2 (i1 int, i2 int) ENGINE=memory;
> +INSERT INTO t2 VALUES (1, 2),(7, 3);
> +SELECT GRANDPARENT1.i1
> +FROM t2 AS GRANDPARENT1
> +WHERE GRANDPARENT1.i2
> +IN ( SELECT PARENT1.i2
> +FROM t2 AS PARENT1 JOIN t1 AS PARENT2 ON (PARENT1.i1 = PARENT2.i1)
> +WHERE
> +GRANDPARENT1.i1 IN ( SELECT CHILD1.i1 FROM t2 AS CHILD1 )
> +ORDER BY PARENT1.i1)
> +ORDER BY GRANDPARENT1.i2 ;
> +i1
> +1
> +DROP TABLE t1,t2;
>   set optimizer_switch=default;
>   set optimizer_join_cache_level=default;
>
> === modified file 'mysql-test/r/subquery_sj_all_jcl7.result'
> --- a/mysql-test/r/subquery_sj_all_jcl7.result	2011-06-08 13:24:56 +0000
> +++ b/mysql-test/r/subquery_sj_all_jcl7.result	2011-06-10 11:10:38 +0000
> @@ -5433,5 +5433,24 @@ a
>   0
>   DROP TABLE t1;
>   DROP VIEW v1;
> +#
> +# Bug#12608157: ASSERT IN FIELD_LONG::VAL_INT WHEN USING MEMORY ENGINE
> +#
> +CREATE TABLE t1 (i1 int);
> +INSERT INTO t1 VALUES (1);
> +CREATE TABLE t2 (i1 int, i2 int) ENGINE=memory;
> +INSERT INTO t2 VALUES (1, 2),(7, 3);
> +SELECT GRANDPARENT1.i1
> +FROM t2 AS GRANDPARENT1
> +WHERE GRANDPARENT1.i2
> +IN ( SELECT PARENT1.i2
> +FROM t2 AS PARENT1 JOIN t1 AS PARENT2 ON (PARENT1.i1 = PARENT2.i1)
> +WHERE
> +GRANDPARENT1.i1 IN ( SELECT CHILD1.i1 FROM t2 AS CHILD1 )
> +ORDER BY PARENT1.i1)
> +ORDER BY GRANDPARENT1.i2 ;
> +i1
> +1
> +DROP TABLE t1,t2;
>   set optimizer_switch=default;
>   set optimizer_join_cache_level=default;
>
> === modified file 'mysql-test/r/subquery_sj_dupsweed.result'
> --- a/mysql-test/r/subquery_sj_dupsweed.result	2011-03-17 11:23:06 +0000
> +++ b/mysql-test/r/subquery_sj_dupsweed.result	2011-06-10 11:10:38 +0000
> @@ -5428,4 +5428,23 @@ a
>   0
>   DROP TABLE t1;
>   DROP VIEW v1;
> +#
> +# Bug#12608157: ASSERT IN FIELD_LONG::VAL_INT WHEN USING MEMORY ENGINE
> +#
> +CREATE TABLE t1 (i1 int);
> +INSERT INTO t1 VALUES (1);
> +CREATE TABLE t2 (i1 int, i2 int) ENGINE=memory;
> +INSERT INTO t2 VALUES (1, 2),(7, 3);
> +SELECT GRANDPARENT1.i1
> +FROM t2 AS GRANDPARENT1
> +WHERE GRANDPARENT1.i2
> +IN ( SELECT PARENT1.i2
> +FROM t2 AS PARENT1 JOIN t1 AS PARENT2 ON (PARENT1.i1 = PARENT2.i1)
> +WHERE
> +GRANDPARENT1.i1 IN ( SELECT CHILD1.i1 FROM t2 AS CHILD1 )
> +ORDER BY PARENT1.i1)
> +ORDER BY GRANDPARENT1.i2 ;
> +i1
> +1
> +DROP TABLE t1,t2;
>   set optimizer_switch=default;
>
> === modified file 'mysql-test/r/subquery_sj_dupsweed_jcl6.result'
> --- a/mysql-test/r/subquery_sj_dupsweed_jcl6.result	2011-03-17 11:23:06 +0000
> +++ b/mysql-test/r/subquery_sj_dupsweed_jcl6.result	2011-06-10 11:10:38 +0000
> @@ -5432,5 +5432,24 @@ a
>   0
>   DROP TABLE t1;
>   DROP VIEW v1;
> +#
> +# Bug#12608157: ASSERT IN FIELD_LONG::VAL_INT WHEN USING MEMORY ENGINE
> +#
> +CREATE TABLE t1 (i1 int);
> +INSERT INTO t1 VALUES (1);
> +CREATE TABLE t2 (i1 int, i2 int) ENGINE=memory;
> +INSERT INTO t2 VALUES (1, 2),(7, 3);
> +SELECT GRANDPARENT1.i1
> +FROM t2 AS GRANDPARENT1
> +WHERE GRANDPARENT1.i2
> +IN ( SELECT PARENT1.i2
> +FROM t2 AS PARENT1 JOIN t1 AS PARENT2 ON (PARENT1.i1 = PARENT2.i1)
> +WHERE
> +GRANDPARENT1.i1 IN ( SELECT CHILD1.i1 FROM t2 AS CHILD1 )
> +ORDER BY PARENT1.i1)
> +ORDER BY GRANDPARENT1.i2 ;
> +i1
> +1
> +DROP TABLE t1,t2;
>   set optimizer_switch=default;
>   set optimizer_join_cache_level=default;
>
> === modified file 'mysql-test/r/subquery_sj_dupsweed_jcl7.result'
> --- a/mysql-test/r/subquery_sj_dupsweed_jcl7.result	2011-03-17 11:23:06 +0000
> +++ b/mysql-test/r/subquery_sj_dupsweed_jcl7.result	2011-06-10 11:10:38 +0000
> @@ -5432,5 +5432,24 @@ a
>   0
>   DROP TABLE t1;
>   DROP VIEW v1;
> +#
> +# Bug#12608157: ASSERT IN FIELD_LONG::VAL_INT WHEN USING MEMORY ENGINE
> +#
> +CREATE TABLE t1 (i1 int);
> +INSERT INTO t1 VALUES (1);
> +CREATE TABLE t2 (i1 int, i2 int) ENGINE=memory;
> +INSERT INTO t2 VALUES (1, 2),(7, 3);
> +SELECT GRANDPARENT1.i1
> +FROM t2 AS GRANDPARENT1
> +WHERE GRANDPARENT1.i2
> +IN ( SELECT PARENT1.i2
> +FROM t2 AS PARENT1 JOIN t1 AS PARENT2 ON (PARENT1.i1 = PARENT2.i1)
> +WHERE
> +GRANDPARENT1.i1 IN ( SELECT CHILD1.i1 FROM t2 AS CHILD1 )
> +ORDER BY PARENT1.i1)
> +ORDER BY GRANDPARENT1.i2 ;
> +i1
> +1
> +DROP TABLE t1,t2;
>   set optimizer_switch=default;
>   set optimizer_join_cache_level=default;
>
> === modified file 'mysql-test/r/subquery_sj_firstmatch.result'
> --- a/mysql-test/r/subquery_sj_firstmatch.result	2011-06-08 13:24:56 +0000
> +++ b/mysql-test/r/subquery_sj_firstmatch.result	2011-06-10 11:10:38 +0000
> @@ -5430,6 +5430,25 @@ a
>   DROP TABLE t1;
>   DROP VIEW v1;
>   #
> +# Bug#12608157: ASSERT IN FIELD_LONG::VAL_INT WHEN USING MEMORY ENGINE
> +#
> +CREATE TABLE t1 (i1 int);
> +INSERT INTO t1 VALUES (1);
> +CREATE TABLE t2 (i1 int, i2 int) ENGINE=memory;
> +INSERT INTO t2 VALUES (1, 2),(7, 3);
> +SELECT GRANDPARENT1.i1
> +FROM t2 AS GRANDPARENT1
> +WHERE GRANDPARENT1.i2
> +IN ( SELECT PARENT1.i2
> +FROM t2 AS PARENT1 JOIN t1 AS PARENT2 ON (PARENT1.i1 = PARENT2.i1)
> +WHERE
> +GRANDPARENT1.i1 IN ( SELECT CHILD1.i1 FROM t2 AS CHILD1 )
> +ORDER BY PARENT1.i1)
> +ORDER BY GRANDPARENT1.i2 ;
> +i1
> +1
> +DROP TABLE t1,t2;
> +#
>   # Bug#51457 Firstmatch semijoin strategy gives wrong results for
>   #           certain query plans
>   #
>
> === modified file 'mysql-test/r/subquery_sj_firstmatch_jcl6.result'
> --- a/mysql-test/r/subquery_sj_firstmatch_jcl6.result	2011-06-08 13:24:56 +0000
> +++ b/mysql-test/r/subquery_sj_firstmatch_jcl6.result	2011-06-10 11:10:38 +0000
> @@ -5434,6 +5434,25 @@ a
>   DROP TABLE t1;
>   DROP VIEW v1;
>   #
> +# Bug#12608157: ASSERT IN FIELD_LONG::VAL_INT WHEN USING MEMORY ENGINE
> +#
> +CREATE TABLE t1 (i1 int);
> +INSERT INTO t1 VALUES (1);
> +CREATE TABLE t2 (i1 int, i2 int) ENGINE=memory;
> +INSERT INTO t2 VALUES (1, 2),(7, 3);
> +SELECT GRANDPARENT1.i1
> +FROM t2 AS GRANDPARENT1
> +WHERE GRANDPARENT1.i2
> +IN ( SELECT PARENT1.i2
> +FROM t2 AS PARENT1 JOIN t1 AS PARENT2 ON (PARENT1.i1 = PARENT2.i1)
> +WHERE
> +GRANDPARENT1.i1 IN ( SELECT CHILD1.i1 FROM t2 AS CHILD1 )
> +ORDER BY PARENT1.i1)
> +ORDER BY GRANDPARENT1.i2 ;
> +i1
> +1
> +DROP TABLE t1,t2;
> +#
>   # Bug#51457 Firstmatch semijoin strategy gives wrong results for
>   #           certain query plans
>   #
>
> === modified file 'mysql-test/r/subquery_sj_firstmatch_jcl7.result'
> --- a/mysql-test/r/subquery_sj_firstmatch_jcl7.result	2011-06-08 13:24:56 +0000
> +++ b/mysql-test/r/subquery_sj_firstmatch_jcl7.result	2011-06-10 11:10:38 +0000
> @@ -5434,6 +5434,25 @@ a
>   DROP TABLE t1;
>   DROP VIEW v1;
>   #
> +# Bug#12608157: ASSERT IN FIELD_LONG::VAL_INT WHEN USING MEMORY ENGINE
> +#
> +CREATE TABLE t1 (i1 int);
> +INSERT INTO t1 VALUES (1);
> +CREATE TABLE t2 (i1 int, i2 int) ENGINE=memory;
> +INSERT INTO t2 VALUES (1, 2),(7, 3);
> +SELECT GRANDPARENT1.i1
> +FROM t2 AS GRANDPARENT1
> +WHERE GRANDPARENT1.i2
> +IN ( SELECT PARENT1.i2
> +FROM t2 AS PARENT1 JOIN t1 AS PARENT2 ON (PARENT1.i1 = PARENT2.i1)
> +WHERE
> +GRANDPARENT1.i1 IN ( SELECT CHILD1.i1 FROM t2 AS CHILD1 )
> +ORDER BY PARENT1.i1)
> +ORDER BY GRANDPARENT1.i2 ;
> +i1
> +1
> +DROP TABLE t1,t2;
> +#
>   # Bug#51457 Firstmatch semijoin strategy gives wrong results for
>   #           certain query plans
>   #
>
> === modified file 'mysql-test/r/subquery_sj_loosescan.result'
> --- a/mysql-test/r/subquery_sj_loosescan.result	2011-03-17 11:23:06 +0000
> +++ b/mysql-test/r/subquery_sj_loosescan.result	2011-06-10 11:10:38 +0000
> @@ -5429,4 +5429,23 @@ a
>   0
>   DROP TABLE t1;
>   DROP VIEW v1;
> +#
> +# Bug#12608157: ASSERT IN FIELD_LONG::VAL_INT WHEN USING MEMORY ENGINE
> +#
> +CREATE TABLE t1 (i1 int);
> +INSERT INTO t1 VALUES (1);
> +CREATE TABLE t2 (i1 int, i2 int) ENGINE=memory;
> +INSERT INTO t2 VALUES (1, 2),(7, 3);
> +SELECT GRANDPARENT1.i1
> +FROM t2 AS GRANDPARENT1
> +WHERE GRANDPARENT1.i2
> +IN ( SELECT PARENT1.i2
> +FROM t2 AS PARENT1 JOIN t1 AS PARENT2 ON (PARENT1.i1 = PARENT2.i1)
> +WHERE
> +GRANDPARENT1.i1 IN ( SELECT CHILD1.i1 FROM t2 AS CHILD1 )
> +ORDER BY PARENT1.i1)
> +ORDER BY GRANDPARENT1.i2 ;
> +i1
> +1
> +DROP TABLE t1,t2;
>   set optimizer_switch=default;
>
> === modified file 'mysql-test/r/subquery_sj_loosescan_jcl6.result'
> --- a/mysql-test/r/subquery_sj_loosescan_jcl6.result	2011-03-17 11:23:06 +0000
> +++ b/mysql-test/r/subquery_sj_loosescan_jcl6.result	2011-06-10 11:10:38 +0000
> @@ -5433,5 +5433,24 @@ a
>   0
>   DROP TABLE t1;
>   DROP VIEW v1;
> +#
> +# Bug#12608157: ASSERT IN FIELD_LONG::VAL_INT WHEN USING MEMORY ENGINE
> +#
> +CREATE TABLE t1 (i1 int);
> +INSERT INTO t1 VALUES (1);
> +CREATE TABLE t2 (i1 int, i2 int) ENGINE=memory;
> +INSERT INTO t2 VALUES (1, 2),(7, 3);
> +SELECT GRANDPARENT1.i1
> +FROM t2 AS GRANDPARENT1
> +WHERE GRANDPARENT1.i2
> +IN ( SELECT PARENT1.i2
> +FROM t2 AS PARENT1 JOIN t1 AS PARENT2 ON (PARENT1.i1 = PARENT2.i1)
> +WHERE
> +GRANDPARENT1.i1 IN ( SELECT CHILD1.i1 FROM t2 AS CHILD1 )
> +ORDER BY PARENT1.i1)
> +ORDER BY GRANDPARENT1.i2 ;
> +i1
> +1
> +DROP TABLE t1,t2;
>   set optimizer_switch=default;
>   set optimizer_join_cache_level=default;
>
> === modified file 'mysql-test/r/subquery_sj_loosescan_jcl7.result'
> --- a/mysql-test/r/subquery_sj_loosescan_jcl7.result	2011-03-17 11:23:06 +0000
> +++ b/mysql-test/r/subquery_sj_loosescan_jcl7.result	2011-06-10 11:10:38 +0000
> @@ -5433,5 +5433,24 @@ a
>   0
>   DROP TABLE t1;
>   DROP VIEW v1;
> +#
> +# Bug#12608157: ASSERT IN FIELD_LONG::VAL_INT WHEN USING MEMORY ENGINE
> +#
> +CREATE TABLE t1 (i1 int);
> +INSERT INTO t1 VALUES (1);
> +CREATE TABLE t2 (i1 int, i2 int) ENGINE=memory;
> +INSERT INTO t2 VALUES (1, 2),(7, 3);
> +SELECT GRANDPARENT1.i1
> +FROM t2 AS GRANDPARENT1
> +WHERE GRANDPARENT1.i2
> +IN ( SELECT PARENT1.i2
> +FROM t2 AS PARENT1 JOIN t1 AS PARENT2 ON (PARENT1.i1 = PARENT2.i1)
> +WHERE
> +GRANDPARENT1.i1 IN ( SELECT CHILD1.i1 FROM t2 AS CHILD1 )
> +ORDER BY PARENT1.i1)
> +ORDER BY GRANDPARENT1.i2 ;
> +i1
> +1
> +DROP TABLE t1,t2;
>   set optimizer_switch=default;
>   set optimizer_join_cache_level=default;
>
> === modified file 'mysql-test/r/subquery_sj_mat.result'
> --- a/mysql-test/r/subquery_sj_mat.result	2011-06-08 13:24:56 +0000
> +++ b/mysql-test/r/subquery_sj_mat.result	2011-06-10 11:10:38 +0000
> @@ -5429,4 +5429,23 @@ a
>   0
>   DROP TABLE t1;
>   DROP VIEW v1;
> +#
> +# Bug#12608157: ASSERT IN FIELD_LONG::VAL_INT WHEN USING MEMORY ENGINE
> +#
> +CREATE TABLE t1 (i1 int);
> +INSERT INTO t1 VALUES (1);
> +CREATE TABLE t2 (i1 int, i2 int) ENGINE=memory;
> +INSERT INTO t2 VALUES (1, 2),(7, 3);
> +SELECT GRANDPARENT1.i1
> +FROM t2 AS GRANDPARENT1
> +WHERE GRANDPARENT1.i2
> +IN ( SELECT PARENT1.i2
> +FROM t2 AS PARENT1 JOIN t1 AS PARENT2 ON (PARENT1.i1 = PARENT2.i1)
> +WHERE
> +GRANDPARENT1.i1 IN ( SELECT CHILD1.i1 FROM t2 AS CHILD1 )
> +ORDER BY PARENT1.i1)
> +ORDER BY GRANDPARENT1.i2 ;
> +i1
> +1
> +DROP TABLE t1,t2;
>   set optimizer_switch=default;
>
> === modified file 'mysql-test/r/subquery_sj_mat_jcl6.result'
> --- a/mysql-test/r/subquery_sj_mat_jcl6.result	2011-06-08 13:24:56 +0000
> +++ b/mysql-test/r/subquery_sj_mat_jcl6.result	2011-06-10 11:10:38 +0000
> @@ -5433,5 +5433,24 @@ a
>   0
>   DROP TABLE t1;
>   DROP VIEW v1;
> +#
> +# Bug#12608157: ASSERT IN FIELD_LONG::VAL_INT WHEN USING MEMORY ENGINE
> +#
> +CREATE TABLE t1 (i1 int);
> +INSERT INTO t1 VALUES (1);
> +CREATE TABLE t2 (i1 int, i2 int) ENGINE=memory;
> +INSERT INTO t2 VALUES (1, 2),(7, 3);
> +SELECT GRANDPARENT1.i1
> +FROM t2 AS GRANDPARENT1
> +WHERE GRANDPARENT1.i2
> +IN ( SELECT PARENT1.i2
> +FROM t2 AS PARENT1 JOIN t1 AS PARENT2 ON (PARENT1.i1 = PARENT2.i1)
> +WHERE
> +GRANDPARENT1.i1 IN ( SELECT CHILD1.i1 FROM t2 AS CHILD1 )
> +ORDER BY PARENT1.i1)
> +ORDER BY GRANDPARENT1.i2 ;
> +i1
> +1
> +DROP TABLE t1,t2;
>   set optimizer_switch=default;
>   set optimizer_join_cache_level=default;
>
> === modified file 'mysql-test/r/subquery_sj_mat_jcl7.result'
> --- a/mysql-test/r/subquery_sj_mat_jcl7.result	2011-06-08 13:24:56 +0000
> +++ b/mysql-test/r/subquery_sj_mat_jcl7.result	2011-06-10 11:10:38 +0000
> @@ -5433,5 +5433,24 @@ a
>   0
>   DROP TABLE t1;
>   DROP VIEW v1;
> +#
> +# Bug#12608157: ASSERT IN FIELD_LONG::VAL_INT WHEN USING MEMORY ENGINE
> +#
> +CREATE TABLE t1 (i1 int);
> +INSERT INTO t1 VALUES (1);
> +CREATE TABLE t2 (i1 int, i2 int) ENGINE=memory;
> +INSERT INTO t2 VALUES (1, 2),(7, 3);
> +SELECT GRANDPARENT1.i1
> +FROM t2 AS GRANDPARENT1
> +WHERE GRANDPARENT1.i2
> +IN ( SELECT PARENT1.i2
> +FROM t2 AS PARENT1 JOIN t1 AS PARENT2 ON (PARENT1.i1 = PARENT2.i1)
> +WHERE
> +GRANDPARENT1.i1 IN ( SELECT CHILD1.i1 FROM t2 AS CHILD1 )
> +ORDER BY PARENT1.i1)
> +ORDER BY GRANDPARENT1.i2 ;
> +i1
> +1
> +DROP TABLE t1,t2;
>   set optimizer_switch=default;
>   set optimizer_join_cache_level=default;
>
> === modified file 'mysql-test/r/subquery_sj_mat_nosj.result'
> --- a/mysql-test/r/subquery_sj_mat_nosj.result	2011-03-17 11:23:06 +0000
> +++ b/mysql-test/r/subquery_sj_mat_nosj.result	2011-06-10 11:10:38 +0000
> @@ -5651,4 +5651,23 @@ a
>   0
>   DROP TABLE t1;
>   DROP VIEW v1;
> +#
> +# Bug#12608157: ASSERT IN FIELD_LONG::VAL_INT WHEN USING MEMORY ENGINE
> +#
> +CREATE TABLE t1 (i1 int);
> +INSERT INTO t1 VALUES (1);
> +CREATE TABLE t2 (i1 int, i2 int) ENGINE=memory;
> +INSERT INTO t2 VALUES (1, 2),(7, 3);
> +SELECT GRANDPARENT1.i1
> +FROM t2 AS GRANDPARENT1
> +WHERE GRANDPARENT1.i2
> +IN ( SELECT PARENT1.i2
> +FROM t2 AS PARENT1 JOIN t1 AS PARENT2 ON (PARENT1.i1 = PARENT2.i1)
> +WHERE
> +GRANDPARENT1.i1 IN ( SELECT CHILD1.i1 FROM t2 AS CHILD1 )
> +ORDER BY PARENT1.i1)
> +ORDER BY GRANDPARENT1.i2 ;
> +i1
> +1
> +DROP TABLE t1,t2;
>   set optimizer_switch=default;
>
> === modified file 'mysql-test/r/subquery_sj_none.result'
> --- a/mysql-test/r/subquery_sj_none.result	2011-03-17 08:00:10 +0000
> +++ b/mysql-test/r/subquery_sj_none.result	2011-06-10 11:10:38 +0000
> @@ -5574,4 +5574,23 @@ a
>   0
>   DROP TABLE t1;
>   DROP VIEW v1;
> +#
> +# Bug#12608157: ASSERT IN FIELD_LONG::VAL_INT WHEN USING MEMORY ENGINE
> +#
> +CREATE TABLE t1 (i1 int);
> +INSERT INTO t1 VALUES (1);
> +CREATE TABLE t2 (i1 int, i2 int) ENGINE=memory;
> +INSERT INTO t2 VALUES (1, 2),(7, 3);
> +SELECT GRANDPARENT1.i1
> +FROM t2 AS GRANDPARENT1
> +WHERE GRANDPARENT1.i2
> +IN ( SELECT PARENT1.i2
> +FROM t2 AS PARENT1 JOIN t1 AS PARENT2 ON (PARENT1.i1 = PARENT2.i1)
> +WHERE
> +GRANDPARENT1.i1 IN ( SELECT CHILD1.i1 FROM t2 AS CHILD1 )
> +ORDER BY PARENT1.i1)
> +ORDER BY GRANDPARENT1.i2 ;
> +i1
> +1
> +DROP TABLE t1,t2;
>   set optimizer_switch=default;
>
> === modified file 'mysql-test/r/subquery_sj_none_jcl6.result'
> --- a/mysql-test/r/subquery_sj_none_jcl6.result	2011-03-17 11:23:06 +0000
> +++ b/mysql-test/r/subquery_sj_none_jcl6.result	2011-06-10 11:10:38 +0000
> @@ -5578,5 +5578,24 @@ a
>   0
>   DROP TABLE t1;
>   DROP VIEW v1;
> +#
> +# Bug#12608157: ASSERT IN FIELD_LONG::VAL_INT WHEN USING MEMORY ENGINE
> +#
> +CREATE TABLE t1 (i1 int);
> +INSERT INTO t1 VALUES (1);
> +CREATE TABLE t2 (i1 int, i2 int) ENGINE=memory;
> +INSERT INTO t2 VALUES (1, 2),(7, 3);
> +SELECT GRANDPARENT1.i1
> +FROM t2 AS GRANDPARENT1
> +WHERE GRANDPARENT1.i2
> +IN ( SELECT PARENT1.i2
> +FROM t2 AS PARENT1 JOIN t1 AS PARENT2 ON (PARENT1.i1 = PARENT2.i1)
> +WHERE
> +GRANDPARENT1.i1 IN ( SELECT CHILD1.i1 FROM t2 AS CHILD1 )
> +ORDER BY PARENT1.i1)
> +ORDER BY GRANDPARENT1.i2 ;
> +i1
> +1
> +DROP TABLE t1,t2;
>   set optimizer_switch=default;
>   set optimizer_join_cache_level=default;
>
> === modified file 'mysql-test/r/subquery_sj_none_jcl7.result'
> --- a/mysql-test/r/subquery_sj_none_jcl7.result	2011-03-17 11:23:06 +0000
> +++ b/mysql-test/r/subquery_sj_none_jcl7.result	2011-06-10 11:10:38 +0000
> @@ -5578,5 +5578,24 @@ a
>   0
>   DROP TABLE t1;
>   DROP VIEW v1;
> +#
> +# Bug#12608157: ASSERT IN FIELD_LONG::VAL_INT WHEN USING MEMORY ENGINE
> +#
> +CREATE TABLE t1 (i1 int);
> +INSERT INTO t1 VALUES (1);
> +CREATE TABLE t2 (i1 int, i2 int) ENGINE=memory;
> +INSERT INTO t2 VALUES (1, 2),(7, 3);
> +SELECT GRANDPARENT1.i1
> +FROM t2 AS GRANDPARENT1
> +WHERE GRANDPARENT1.i2
> +IN ( SELECT PARENT1.i2
> +FROM t2 AS PARENT1 JOIN t1 AS PARENT2 ON (PARENT1.i1 = PARENT2.i1)
> +WHERE
> +GRANDPARENT1.i1 IN ( SELECT CHILD1.i1 FROM t2 AS CHILD1 )
> +ORDER BY PARENT1.i1)
> +ORDER BY GRANDPARENT1.i2 ;
> +i1
> +1
> +DROP TABLE t1,t2;
>   set optimizer_switch=default;
>   set optimizer_join_cache_level=default;
>
> === modified file 'sql/item_subselect.cc'
> --- a/sql/item_subselect.cc	2011-05-24 09:36:11 +0000
> +++ b/sql/item_subselect.cc	2011-06-10 11:10:38 +0000
> @@ -237,11 +237,12 @@ err:
>     return res;
>   }
>
> -
> -bool Item_subselect::walk(Item_processor processor, bool walk_subquery,
> -                          uchar *argument)
> +/**
> +  Workaround for bug in gcc 4.1. @See Item_in_subselect::walk()
> +*/
> +bool Item_subselect::walk_body(Item_processor processor, bool walk_subquery,
> +                               uchar *argument)
>   {
> -
>     if (walk_subquery)
>     {
>       for (SELECT_LEX *lex= unit->first_select(); lex; lex=
> lex->next_select())
> @@ -276,6 +277,12 @@ bool Item_subselect::walk(Item_processor
>     return (this->*processor)(argument);
>   }
>
> +bool Item_subselect::walk(Item_processor processor, bool walk_subquery,
> +                          uchar *argument)
> +{
> +  return walk_body(processor, walk_subquery, argument);
> +}
> +
>
>   bool Item_subselect::exec()
>   {
> @@ -369,6 +376,18 @@ void Item_subselect::fix_after_pullout(s
>     }
>   }
>
> +bool Item_in_subselect::walk(Item_processor processor, bool walk_subquery,
> +                             uchar *argument)
> +{
> +  if (left_expr->walk(processor, walk_subquery, argument))
> +    return true;
> +  /*
> +    Cannot call "Item_subselect::walk(...)" because with gcc 4.1
> +    Item_in_subselect::walk() was incorrectly called instead.
> +    Using Item_subselect::walk_body() instead is a workaround.
> +  */
> +  return walk_body(processor, walk_subquery, argument);
> +}
>
>   /*
>     Compute the IN predicate if the left operand's cache changed.
>
> === modified file 'sql/item_subselect.h'
> --- a/sql/item_subselect.h	2011-04-06 11:13:33 +0000
> +++ b/sql/item_subselect.h	2011-06-10 11:10:38 +0000
> @@ -154,6 +154,7 @@ public:
>     */
>     virtual void reset_value_registration() {}
>     enum_parsing_place place() { return parsing_place; }
> +  bool walk_body(Item_processor processor, bool walk_subquery, uchar *arg);
>     bool walk(Item_processor processor, bool walk_subquery, uchar *arg);
>
>     /**
> @@ -392,6 +393,7 @@ public:
>     trans_res single_value_in_to_exists_transformer(JOIN * join,
>                                                     Comp_creator *func);
>     trans_res row_value_in_to_exists_transformer(JOIN * join);
> +  bool walk(Item_processor processor, bool walk_subquery, uchar *arg);
>     virtual bool exec();
>     longlong val_int();
>     double val_real();
>
>
>
>


Thread
bzr commit into mysql-trunk branch (jorgen.loland:3380) Bug#12608157Jorgen Loland10 Jun
  • Re: bzr commit into mysql-trunk branch (jorgen.loland:3380) Bug#12608157Roy Lyseng10 Jun