List:Commits« Previous MessageNext Message »
From:Tor Didriksen Date:March 17 2011 11:48am
Subject:bzr push into mysql-trunk branch (tor.didriksen:3779 to 3780) Bug#11766678
View as plain text  
 3780 Tor Didriksen	2011-03-17
      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
 3779 Jon Olav Hauglid	2011-03-17
      Bug #11829666 (former 60180)
      Unused mutex THR_LOCK_isam
      
      The problem was that the THR_LOCK_isam mutex was declared,
      initialized and destroyed, but not used anywhere.
      This patch removes the THR_LOCK_isam mutex completely.
      No functional changes. 
      
      No test case added.

    modified:
      mysql-test/suite/perfschema/r/server_init.result
      mysql-test/suite/perfschema/t/server_init.test
      mysys/my_init.c
      mysys/my_thr_init.c
      mysys/mysys_priv.h
=== 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-03-17 11:48:04 +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-03-17 11:48:04 +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-03-17 11:48:04 +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-03-17 11:48:04 +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-03-17 11:48:04 +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-03-11 09:35:38 +0000
+++ b/sql/item_func.h	2011-03-17 11:48:04 +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-03-03 22:26:19 +0000
+++ b/sql/opt_range.cc	2011-03-17 11:48:04 +0000
@@ -10136,11 +10136,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-03-17 09:47:50 +0000
+++ b/sql/sql_select.cc	2011-03-17 11:48:04 +0000
@@ -10045,12 +10045,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;
     }

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (tor.didriksen:3779 to 3780) Bug#11766678Tor Didriksen17 Mar