List:Commits« Previous MessageNext Message »
From:igor Date:May 30 2008 9:26am
Subject:bk commit into 5.1 tree (igor:1.2654) BUG#37004
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of igor.  When igor does a push these changes
will be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2008-05-30 00:26:02-07:00, igor@stripped +3 -0
  Fixed bug #37004.
  The value of JOIN::tables must be set to 0 when is no matching min/max row.

  mysql-test/r/subselect.result@stripped, 2008-05-30 00:24:34-07:00, igor@stripped +7
-0
    Added a test case for bug #37004.

  mysql-test/t/subselect.test@stripped, 2008-05-30 00:25:50-07:00, igor@stripped +12 -0
    Added a test case for bug #37004.

  sql/sql_select.cc@stripped, 2008-05-30 00:25:50-07:00, igor@stripped +2 -0
    Fixed bug #37004.
    The value of JOIN::tables must be set to 0 when is no matching min/max row.

diff -Nrup a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
--- a/mysql-test/r/subselect.result	2008-05-16 09:27:44 -07:00
+++ b/mysql-test/r/subselect.result	2008-05-30 00:24:34 -07:00
@@ -4391,3 +4391,10 @@ SELECT * FROM t1 WHERE _utf8'a' = ANY (S
 s1
 a
 DROP TABLE t1;
+CREATE TABLE t1(c int, KEY(c));
+CREATE TABLE t2(a int, b int);
+INSERT INTO t2 VALUES (1, 10), (2, NULL);
+INSERT INTO t1 VALUES (1), (3);
+SELECT * FROM t2 WHERE b NOT IN (SELECT max(t.c) FROM t1, t1 t WHERE t.c>10);
+a	b
+DROP TABLE t1,t2;
diff -Nrup a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
--- a/mysql-test/t/subselect.test	2008-05-16 09:03:35 -07:00
+++ b/mysql-test/t/subselect.test	2008-05-30 00:25:50 -07:00
@@ -3273,3 +3273,15 @@ INSERT INTO t1 VALUES ('a');
 SELECT * FROM t1 WHERE _utf8'a' = ANY (SELECT s1 FROM t1);
 DROP TABLE t1;
 
+#
+# Bug #37004: NOT IN subquery with MAX over an empty set
+#
+
+CREATE TABLE t1(c int, KEY(c));
+CREATE TABLE t2(a int, b int);
+INSERT INTO t2 VALUES (1, 10), (2, NULL);
+INSERT INTO t1 VALUES (1), (3);
+
+SELECT * FROM t2 WHERE b NOT IN (SELECT max(t.c) FROM t1, t1 t WHERE t.c>10);
+
+DROP TABLE t1,t2;
diff -Nrup a/sql/sql_select.cc b/sql/sql_select.cc
--- a/sql/sql_select.cc	2008-05-16 08:56:57 -07:00
+++ b/sql/sql_select.cc	2008-05-30 00:25:50 -07:00
@@ -888,6 +888,7 @@ JOIN::optimize()
       {
         DBUG_PRINT("info",("No matching min/max row"));
 	zero_result_cause= "No matching min/max row";
+        tables= 0;
 	error=0;
 	DBUG_RETURN(0);
       }
@@ -901,6 +902,7 @@ JOIN::optimize()
       {
         DBUG_PRINT("info",("No matching min/max row"));
         zero_result_cause= "No matching min/max row";
+        tables= 0;
         error=0;
         DBUG_RETURN(0);
       }
Thread
bk commit into 5.1 tree (igor:1.2654) BUG#37004igor30 May