List:Commits« Previous MessageNext Message »
From:Tor Didriksen Date:February 23 2011 12:23pm
Subject:bzr commit into mysql-trunk branch (tor.didriksen:3706) Bug#11766678
View as plain text  
#At file:///export/home/didrik/repo/trunk-bug59843valgrind/ based on revid:alexander.barkov@stripped

 3706 Tor Didriksen	2011-02-23
      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/sql_select.cc
        Do not access child nodes of functions without arguments.

    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/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-23 12:23:56 +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)
+);
+
+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-23 12:23:56 +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-23 12:23:56 +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-23 12:23:56 +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-23 12:23:56 +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/sql_select.cc'
--- a/sql/sql_select.cc	2011-02-22 14:24:33 +0000
+++ b/sql/sql_select.cc	2011-02-23 12:23:56 +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;
     }


Attachment: [text/bzr-bundle] bzr/tor.didriksen@oracle.com-20110223122356-p4qxau6n9av9u9j8.bundle
Thread
bzr commit into mysql-trunk branch (tor.didriksen:3706) Bug#11766678Tor Didriksen23 Feb