Hello Evgeny,
Evgeny Potemkin a écrit, Le 28.07.2009 13:37:
> #At file:///work/bzrroot/43600-bug-azalea/ based on
> revid:alik@stripped
>
> 2825 Evgeny Potemkin 2009-07-28
> Bug#43600: Incorrect type conversion caused wrong result.
>
> The index_cond_func_xxx function is used to evaluate pushed index condition or
> return an error if the tuple being checked is out of range.
> And there are two bugs in it:
> 1) The function result type is my_bool, but actually it can return 3
> values - TRUE/FALSE/OUT OF RANGE.
> 2) The type of the pushed condition evaluation is converted to my_bool, but
> since the evaluation result isn't checked it's possible to return values
> other that 0/1, thus falsely returning OUT OF RANGE.
> === modified file 'include/my_handler.h'
> --- a/include/my_handler.h 2008-11-12 15:23:22 +0000
> +++ b/include/my_handler.h 2009-07-28 11:37:42 +0000
> @@ -123,8 +123,29 @@ extern void my_handler_error_unregister(
> this amount of bytes.
> */
> #define portable_sizeof_char_ptr 8
> +
> +/*
Could you please use /**, to have the descripion be picked up by Doxygen?
> + Return values of index_cond_func_xxx functions.
> +
> + 0=ICP_NO_MATCH - index tuple doesn't satisfy the pushed index condition (the
> + engine should discard the tuple and go to the next one)
> + 1=ICP_MATCH - index tuple satisfies the pushed index condition (the engine
> + should fetch and return the record)
> + 2=ICP_OUT_OF_RANGE - index tuple is out range that we're scanning, e.g. this
> + if we're scanning "t.key BETWEEN 10 AND 20" and got a
> + "t.key=21" tuple (the engine should stop scanning and return
> + HA_ERR_END_OF_FILE right away).
> +*/
> === modified file 'mysql-test/r/innodb_mysql.result'
> --- a/mysql-test/r/innodb_mysql.result 2009-07-09 16:11:01 +0000
> +++ b/mysql-test/r/innodb_mysql.result 2009-07-28 11:37:42 +0000
> @@ -1764,6 +1764,33 @@ id select_type table type possible_keys
> 2 DERIVED t1 index c3,c2 c2 14 NULL 5
> DROP TABLE t1;
> End of 5.1 tests
> +#
> +# Bug#43600: Incorrect type conversion caused wrong result.
> +#
> +CREATE TABLE t1 (
> +a int NOT NULL
> +) engine= innodb;
> +CREATE TABLE t2 (
> +a int NOT NULL,
> +b int NOT NULL,
> +filler char(100) DEFAULT NULL,
> +KEY a (a,b)
> +) engine= innodb;
> +insert into t1 values (0),(1),(2),(3),(4);
> +insert into t2 select A.a + 10 *B.a, 1, 'filler' from t1 A, t1 B;
> +explain select * from t1, t2 where t2.a=t1.a and t2.b + 1;
> +id select_type table type possible_keys key key_len ref rows Extra
> +1 SIMPLE t1 ALL NULL NULL NULL NULL 5
> +1 SIMPLE t2 ref a a 4 test.t1.a 1 Using where
Is it ok to have "using where" here, whereas myisam.result says "Using
index condition". Maybe, I don't know, I'm just asking.
> +select * from t1, t2 where t2.a=t1.a and t2.b + 1;
> +a a b filler
> +0 0 1 filler
> +1 1 1 filler
> +2 2 1 filler
> +3 3 1 filler
> +4 4 1 filler
> +drop table t1,t2;
> +# End of test case for the bug#43600
> drop table if exists t1, t2, t3;
> create table t1(a int);
> insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
>
--
Mr. Guilhem Bichot <guilhem@stripped>
Sun Microsystems / MySQL, Lead Software Engineer
Bordeaux, France
www.sun.com / www.mysql.com