List:Commits« Previous MessageNext Message »
From:Olav Sandstaa Date:February 24 2011 12:41pm
Subject:Re: bzr commit into mysql-trunk branch (tor.didriksen:3709) Bug#11766678
View as plain text  
Hi Tor,

Thanks for fixing this. The patch looks good and solves the problem. I 
have only one tiny comments that you are free to ignore (see inline).

OK to push the patch.

Olav


On 24/02/2011 09:57, Tor Didriksen wrote:
> #At file:///export/home/didrik/repo/trunk-bug59843valgrind/ based on
> revid:vasil.dimov@stripped
>
>   3709 Tor Didriksen	2011-02-24
>        Bug #11766678 - 59843:USING UNINITIALISED VALUE IN USES_INDEX_FIELDS_ONLY
>       @ mysql-test/include/icp_tests.inc
>          New test case.
>       @ mysql-test/r/innodb_icp.result
>          New test case.
>       @ mysql-test/r/innodb_icp_none.result
>          New test case.
>       @ mysql-test/r/myisam_icp.result
>          New test case.
>       @ mysql-test/r/myisam_icp_none.result
>          New test case.
>       @ sql/item_func.h
>          DBUG_ASSERT that we don't access arguments when argument_count == 0
>       @ sql/opt_range.cc
>          don't access arguments when argument_count == 0
>       @ sql/sql_select.cc
>          don't access arguments when argument_count == 0
>
>      modified:
>        mysql-test/include/icp_tests.inc
>        mysql-test/r/innodb_icp.result
>        mysql-test/r/innodb_icp_none.result
>        mysql-test/r/myisam_icp.result
>        mysql-test/r/myisam_icp_none.result
>        sql/item_func.h
>        sql/opt_range.cc
>        sql/sql_select.cc
> === modified file 'mysql-test/include/icp_tests.inc'
> --- a/mysql-test/include/icp_tests.inc	2011-01-31 11:56:15 +0000
> +++ b/mysql-test/include/icp_tests.inc	2011-02-24 08:57:54 +0000
> @@ -821,3 +821,20 @@ SELECT * FROM t1 WHERE i2 IN (3, 6) LIMI
>   INSERT INTO t1 (i2) VALUES (1);
>
>   DROP TABLE t1;
> +
> +--echo #
> +--echo # Bug #11766678 - 59843:
> +--echo # USING UNINITIALISED VALUE IN USES_INDEX_FIELDS_ONLY
> +--echo #
> +
> +CREATE TABLE t1 (
> +  col999 float not null,
> +  col1000 varbinary(179) not null,
> +  col1003 date default null,
> +  key idx4267 (col1000,col1003)
> +);

I think we are trying to use mostly upper case for SQL reserved words in 
our tests. So I would have written the data types and not/default null 
in upper case (but feel free to ignore this).

> +
> +INSERT INTO t1 VALUES (),();
> +SELECT col999 FROM t1 WHERE col1000 = "3" AND col1003<=>  sysdate();
> +
> +DROP TABLE t1;
>
> === modified file 'mysql-test/r/innodb_icp.result'
> --- a/mysql-test/r/innodb_icp.result	2011-02-14 11:21:26 +0000
> +++ b/mysql-test/r/innodb_icp.result	2011-02-24 08:57:54 +0000
> @@ -759,5 +759,22 @@ pk	i1	c1	i2
>   2	1	she	6
>   INSERT INTO t1 (i2) VALUES (1);
>   DROP TABLE t1;
> +#
> +# Bug #11766678 - 59843:
> +# USING UNINITIALISED VALUE IN USES_INDEX_FIELDS_ONLY
> +#
> +CREATE TABLE t1 (
> +col999 float not null,
> +col1000 varbinary(179) not null,
> +col1003 date default null,
> +key idx4267 (col1000,col1003)
> +);
> +INSERT INTO t1 VALUES (),();
> +Warnings:
> +Warning	1364	Field 'col999' doesn't have a default value
> +Warning	1364	Field 'col1000' doesn't have a default value
> +SELECT col999 FROM t1 WHERE col1000 = "3" AND col1003<=>  sysdate();
> +col999
> +DROP TABLE t1;
>   set default_storage_engine= @save_storage_engine;
>   set optimizer_switch=default;
>
> === modified file 'mysql-test/r/innodb_icp_none.result'
> --- a/mysql-test/r/innodb_icp_none.result	2011-02-14 11:21:26 +0000
> +++ b/mysql-test/r/innodb_icp_none.result	2011-02-24 08:57:54 +0000
> @@ -758,5 +758,22 @@ pk	i1	c1	i2
>   2	1	she	6
>   INSERT INTO t1 (i2) VALUES (1);
>   DROP TABLE t1;
> +#
> +# Bug #11766678 - 59843:
> +# USING UNINITIALISED VALUE IN USES_INDEX_FIELDS_ONLY
> +#
> +CREATE TABLE t1 (
> +col999 float not null,
> +col1000 varbinary(179) not null,
> +col1003 date default null,
> +key idx4267 (col1000,col1003)
> +);
> +INSERT INTO t1 VALUES (),();
> +Warnings:
> +Warning	1364	Field 'col999' doesn't have a default value
> +Warning	1364	Field 'col1000' doesn't have a default value
> +SELECT col999 FROM t1 WHERE col1000 = "3" AND col1003<=>  sysdate();
> +col999
> +DROP TABLE t1;
>   set default_storage_engine= @save_storage_engine;
>   set optimizer_switch=default;
>
> === modified file 'mysql-test/r/myisam_icp.result'
> --- a/mysql-test/r/myisam_icp.result	2011-01-31 11:56:15 +0000
> +++ b/mysql-test/r/myisam_icp.result	2011-02-24 08:57:54 +0000
> @@ -757,4 +757,21 @@ pk	i1	c1	i2
>   2	1	she	6
>   INSERT INTO t1 (i2) VALUES (1);
>   DROP TABLE t1;
> +#
> +# Bug #11766678 - 59843:
> +# USING UNINITIALISED VALUE IN USES_INDEX_FIELDS_ONLY
> +#
> +CREATE TABLE t1 (
> +col999 float not null,
> +col1000 varbinary(179) not null,
> +col1003 date default null,
> +key idx4267 (col1000,col1003)
> +);
> +INSERT INTO t1 VALUES (),();
> +Warnings:
> +Warning	1364	Field 'col999' doesn't have a default value
> +Warning	1364	Field 'col1000' doesn't have a default value
> +SELECT col999 FROM t1 WHERE col1000 = "3" AND col1003<=>  sysdate();
> +col999
> +DROP TABLE t1;
>   set optimizer_switch=default;
>
> === modified file 'mysql-test/r/myisam_icp_none.result'
> --- a/mysql-test/r/myisam_icp_none.result	2011-01-31 11:56:15 +0000
> +++ b/mysql-test/r/myisam_icp_none.result	2011-02-24 08:57:54 +0000
> @@ -756,4 +756,21 @@ pk	i1	c1	i2
>   2	1	she	6
>   INSERT INTO t1 (i2) VALUES (1);
>   DROP TABLE t1;
> +#
> +# Bug #11766678 - 59843:
> +# USING UNINITIALISED VALUE IN USES_INDEX_FIELDS_ONLY
> +#
> +CREATE TABLE t1 (
> +col999 float not null,
> +col1000 varbinary(179) not null,
> +col1003 date default null,
> +key idx4267 (col1000,col1003)
> +);
> +INSERT INTO t1 VALUES (),();
> +Warnings:
> +Warning	1364	Field 'col999' doesn't have a default value
> +Warning	1364	Field 'col1000' doesn't have a default value
> +SELECT col999 FROM t1 WHERE col1000 = "3" AND col1003<=>  sysdate();
> +col999
> +DROP TABLE t1;
>   set optimizer_switch=default;
>
> === modified file 'sql/item_func.h'
> --- a/sql/item_func.h	2011-02-21 10:36:31 +0000
> +++ b/sql/item_func.h	2011-02-24 08:57:54 +0000
> @@ -130,7 +130,8 @@ public:
>     virtual bool have_rev_func() const { return 0; }
>     virtual Item *key_item() const { return args[0]; }
>     virtual bool const_item() const { return const_item_cache; }
> -  inline Item **arguments() const { return args; }
> +  inline Item **arguments() const
> +  { DBUG_ASSERT(argument_count()>  0); return args; }
>     void set_arguments(List<Item>  &list);
>     inline uint argument_count() const { return arg_count; }
>     inline void remove_arguments() { arg_count=0; }
>
> === modified file 'sql/opt_range.cc'
> --- a/sql/opt_range.cc	2011-02-02 22:02:29 +0000
> +++ b/sql/opt_range.cc	2011-02-24 08:57:54 +0000
> @@ -10133,11 +10133,11 @@ check_group_min_max_predicates(Item *con
>
>     /* Test if cond references only group-by or non-group fields. */
>     Item_func *pred= (Item_func*) cond;
> -  Item **arguments= pred->arguments();
>     Item *cur_arg;
>     DBUG_PRINT("info", ("Analyzing: %s", pred->func_name()));
>     for (uint arg_idx= 0; arg_idx<  pred->argument_count (); arg_idx++)
>     {
> +    Item **arguments= pred->arguments();
>       cur_arg= arguments[arg_idx]->real_item();
>       DBUG_PRINT("info", ("cur_arg: %s", cur_arg->full_name()));
>       if (cur_arg->type() == Item::FIELD_ITEM)
>
> === modified file 'sql/sql_select.cc'
> --- a/sql/sql_select.cc	2011-02-22 14:24:33 +0000
> +++ b/sql/sql_select.cc	2011-02-24 08:57:54 +0000
> @@ -10036,12 +10036,14 @@ static bool uses_index_fields_only(Item
>       {
>         /* This is a function, apply condition recursively to arguments */
>         Item_func *item_func= (Item_func*)item;
> -      Item **child;
> -      Item **item_end= (item_func->arguments()) +
> item_func->argument_count();
> -      for (child= item_func->arguments(); child != item_end; child++)
> -      {
> -        if (!uses_index_fields_only(*child, tbl, keyno, other_tbls_ok))
> -          return FALSE;
> +      if (item_func->argument_count()>  0)
> +      {
> +        Item **item_end= (item_func->arguments()) +
> item_func->argument_count();
> +        for (Item **child= item_func->arguments(); child != item_end; child++)
> +        {
> +          if (!uses_index_fields_only(*child, tbl, keyno, other_tbls_ok))
> +            return FALSE;
> +        }
>         }
>         return TRUE;
>       }
>
>
>
>


Thread
bzr commit into mysql-trunk branch (tor.didriksen:3709) Bug#11766678Tor Didriksen24 Feb
  • Re: bzr commit into mysql-trunk branch (tor.didriksen:3709) Bug#11766678Olav Sandstaa24 Feb