Hi Gluh,
Thanks for fixing this. The patch looks good. I have only some tiny
comments about the test case that you should feel free to ignore.
Ok to push.
Olav
On 16/05/2011 10:44, Sergey Glukhov wrote:
> #At file:///home/gluh/MySQL/mysql-trunk/ based on
> revid:sergey.glukhov@stripped
>
> 3328 Sergey Glukhov 2011-05-16
> Bug#12402590 ASSERT AT PROTOCOL::END_STATEMENT ON MYSQL-TRUNK RUNNING
> RQG_OPT_SUBQUERY TEST
> There are two problems:
> 1. make_cond_for_table() fails to extract sort table condition for ICP
> The fix is to use (table_map) 0 instead of used_tables
> in third argument for make_cond_for_table() function.
> (for more info see bug11756928).
> 2. when we exit from JOIN::exec due to failed extraction of
> sort table condition for ICP we do not set proper diagnostic
> status of Diagnostics_area(should be my_error() call or something
> similar). There are many places in JOIN::exec (DBUG_VOID_RETURN on
> error without my_error() call) which could have the same problems.
> This problem will be fixed separatly.
> @ mysql-test/r/having.result
> test case
> @ mysql-test/t/having.test
> test case
> @ sql/sql_select.cc
> use (table_map) 0 instead of used_tables in
> third argument for make_cond_for_table() function.
> (for more info see bug11756928).
>
> modified:
> mysql-test/r/having.result
> mysql-test/t/having.test
> sql/sql_select.cc
> === modified file 'mysql-test/r/having.result'
> --- a/mysql-test/r/having.result 2011-04-22 08:05:02 +0000
> +++ b/mysql-test/r/having.result 2011-05-16 08:43:57 +0000
> @@ -589,3 +589,19 @@ pk field1
> 1 7
> drop table `t1`;
> End of 5.5 tests
> +#
> +# Bug#12402590 ASSERT AT PROTOCOL::END_STATEMENT ON MYSQL-TRUNK RUNNING
> RQG_OPT_SUBQUERY TEST
> +#
> +CREATE TABLE t2 (f1 INT, PRIMARY KEY (f1));
> +INSERT INTO t2 VALUES (1), (2);
> +CREATE TABLE t1 (f1 INT, f2 VARCHAR(1), f3 VARCHAR(1),
> +PRIMARY KEY (f1), KEY (f2, f1));
> +INSERT INTO t1 VALUES (8, 'g', 'g'), (11, 'a', 'a');
> +SELECT t1.f1 FROM t1 JOIN t2 ON t2.f1 = t1.f1
> +WHERE t1.f3 AND t1.f2 IN ('f')
> +HAVING (1 ,6) IN (SELECT 3, 6)
> +ORDER BY t1.f1;
> +f1
> +DROP TABLE t1;
> +DROP TABLE t2;
> +End of 5.6 tests
>
> === modified file 'mysql-test/t/having.test'
> --- a/mysql-test/t/having.test 2011-04-22 08:05:02 +0000
> +++ b/mysql-test/t/having.test 2011-05-16 08:43:57 +0000
> @@ -615,3 +615,23 @@ drop table `t1`;
>
> --echo End of 5.5 tests
>
> +--echo #
> +--echo # Bug#12402590 ASSERT AT PROTOCOL::END_STATEMENT ON MYSQL-TRUNK RUNNING
> RQG_OPT_SUBQUERY TEST
Suggestions: add a line break to make the line shorter than 80 characters.
> +--echo #
> +
> +CREATE TABLE t2 (f1 INT, PRIMARY KEY (f1));
> +INSERT INTO t2 VALUES (1), (2);
> +
> +CREATE TABLE t1 (f1 INT, f2 VARCHAR(1), f3 VARCHAR(1),
> +PRIMARY KEY (f1), KEY (f2, f1));
Suggestion: I find it easier to read (but feel free to ignore/disagree)
when writing this like:
CREATE TABALE t1 (
f1 INTEGER,
f2 VARCHAR(1),
f3 VARCHAR(1),
PRIMARY KEY (f1),
KEY (f1, f2)
);
> +INSERT INTO t1 VALUES (8, 'g', 'g'), (11, 'a', 'a');
> +
> +SELECT t1.f1 FROM t1 JOIN t2 ON t2.f1 = t1.f1
> +WHERE t1.f3 AND t1.f2 IN ('f')
> +HAVING (1 ,6) IN (SELECT 3, 6)
> +ORDER BY t1.f1;
> +
> +DROP TABLE t1;
> +DROP TABLE t2;
Suggestion: to save a line:
DROP TABLE t1, t2;
> +
> +--echo End of 5.6 tests
>
> === modified file 'sql/sql_select.cc'
> --- a/sql/sql_select.cc 2011-04-26 08:49:10 +0000
> +++ b/sql/sql_select.cc 2011-05-16 08:43:57 +0000
> @@ -3262,7 +3262,8 @@ JOIN::exec()
> if (curr_table->pre_idx_push_select_cond)
> {
> sort_table_cond= make_cond_for_table(curr_join->tmp_having,
> - used_tables, used_tables, 0);
> + used_tables,
> + (table_map) 0, 0);
> if (!sort_table_cond)
> DBUG_VOID_RETURN;
> Item* new_pre_idx_push_select_cond=
>
>
>
>