List:Commits« Previous MessageNext Message »
From:Tor Didriksen Date:May 2 2012 8:31am
Subject:bzr push into mysql-trunk branch (tor.didriksen:3760 to 3761) Bug#13945257
View as plain text  
 3761 Tor Didriksen	2012-05-02
      Followup patch for Bug#13945257 NEW COMPILATION ERRORS/WARNINGS WITH XCODE 4.3.2
      
      Do not allocate anything on the heap in Fake_TABLE,
      since TABLE::~TABLE() is not virtual.

    modified:
      unittest/gunit/fake_table.h
 3760 Norvald H. Ryeng	2012-05-02
      Bug#13330886 TOO MANY ROWS WITH ALL|ANY
      
      Queries with subquery predicates containing ALL may return incorrect
      results due to a faulty query transformation. E.g.:
      
      SELECT * FROM t1 WHERE b > ALL (SELECT a FROM t2);
      
      is rewritten
      
      SELECT * FROM t1 WHERE b > (SELECT MAX(a) FROM t2);
      
      This transformation in Item_in_subselect::single_value_transformer()
      is correct only when t2.a doesn't contain NULL values. If the subquery
      result contains at least one non-NULL value, MAX(a) returns the
      largest non-NULL value, and this value is compared with b. However,
      (b > ALL(result that contains at least one NULL)) should return UNKNOWN
      unless there is a value in the subquery result that is greater than b,
      in which case the condition should return FALSE.
      
      Fix: Disable this transformation for ALL subquery predicates that may
      return NULL.
      
      This patch also enables the transformation for queries that are not
      top-level if both the left-hand and right-hand expressions are
      non-nullable.
     @ mysql-test/include/subquery.inc
        Add test case for bug #13330886.
     @ mysql-test/r/explain.result
        Changes to EXPLAIN EXTENDED for queries using ALL.
     @ mysql-test/r/explain_json_all.result
        Changes to EXPLAIN for queries using ALL.
     @ mysql-test/r/explain_json_none.result
        Changes to EXPLAIN for queries using ALL.
     @ mysql-test/r/subquery_all.result
        Add test case for bug #13330886. Changes to EXPLAIN EXTENDED for
        queries using ALL.
     @ mysql-test/r/subquery_all_bka.result
        Add test case for bug #13330886. Changes to EXPLAIN EXTENDED for
        queries using ALL.
     @ mysql-test/r/subquery_all_bka_nixbnl.result
        Add test case for bug #13330886. Changes to EXPLAIN EXTENDED for
        queries using ALL.
     @ mysql-test/r/subquery_nomat_nosj.result
        Add test case for bug #13330886. Changes to EXPLAIN EXTENDED for
        queries using ALL.
     @ mysql-test/r/subquery_nomat_nosj_bka.result
        Add test case for bug #13330886. Changes to EXPLAIN EXTENDED for
        queries using ALL.
     @ mysql-test/r/subquery_nomat_nosj_bka_nixbnl.result
        Add test case for bug #13330886. Changes to EXPLAIN EXTENDED for
        queries using ALL.
     @ mysql-test/r/subquery_none.result
        Add test case for bug #13330886. Changes to EXPLAIN EXTENDED for
        queries using ALL.
     @ mysql-test/r/subquery_none_bka.result
        Add test case for bug #13330886. Changes to EXPLAIN EXTENDED for
        queries using ALL.
     @ mysql-test/r/subquery_none_bka_nixbnl.result
        Add test case for bug #13330886. Changes to EXPLAIN EXTENDED for
        queries using ALL.
     @ sql/item_subselect.cc
        Disable MIN/MAX transformation for ALL if the subquery may return
        NULL.

    modified:
      mysql-test/include/subquery.inc
      mysql-test/r/explain.result
      mysql-test/r/explain_json_all.result
      mysql-test/r/explain_json_none.result
      mysql-test/r/subquery_all.result
      mysql-test/r/subquery_all_bka.result
      mysql-test/r/subquery_all_bka_nixbnl.result
      mysql-test/r/subquery_nomat_nosj.result
      mysql-test/r/subquery_nomat_nosj_bka.result
      mysql-test/r/subquery_nomat_nosj_bka_nixbnl.result
      mysql-test/r/subquery_none.result
      mysql-test/r/subquery_none_bka.result
      mysql-test/r/subquery_none_bka_nixbnl.result
      sql/item_subselect.cc
=== modified file 'unittest/gunit/fake_table.h'
--- a/unittest/gunit/fake_table.h	2012-04-12 14:29:14 +0000
+++ b/unittest/gunit/fake_table.h	2012-05-02 08:30:33 +0000
@@ -42,6 +42,8 @@ class Fake_TABLE: public TABLE
 {
   Fake_TABLE_SHARE table_share;
   MY_BITMAP write_set_struct;
+  uint32 write_set_buf;
+  Field *field_array[32];
 
   void inititalize()
   {
@@ -51,8 +53,7 @@ class Fake_TABLE: public TABLE
     write_set= &write_set_struct;
     read_set= NULL;
 
-    EXPECT_EQ(0, bitmap_init(write_set, NULL, s->fields, false))
-      << "Out of memory";
+    EXPECT_EQ(0, bitmap_init(write_set, &write_set_buf, s->fields, false));
 
     static const char *table_name= "Fake";
     for (uint i= 0; i < s->fields; ++i)
@@ -68,16 +69,14 @@ class Fake_TABLE: public TABLE
 public:
   Fake_TABLE(Field *column1) : table_share(1)
   {
-    field= new Field*[1];
-    EXPECT_FALSE(field == NULL) << "Out of memory";
+    field= field_array;
     field[0]= column1;
     inititalize();
   }
 
   Fake_TABLE(Field *column1, Field *column2) : table_share(2)
   {
-    field= new Field*[2];
-    EXPECT_FALSE(field == NULL) << "Out of memory";
+    field= field_array;
     field[0]= column1;
     field[1]= column2;
     inititalize();
@@ -85,8 +84,10 @@ public:
 
   ~Fake_TABLE()
   {
-    bitmap_free(write_set);
-    delete[] field;
+    /*
+      This DTOR should be empty, since we inherit from TABLE,
+      which cannot have virtual member functions.
+    */ 
   }
 };
 

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (tor.didriksen:3760 to 3761) Bug#13945257Tor Didriksen2 May