List:Commits« Previous MessageNext Message »
From:eugene Date:December 15 2006 9:06pm
Subject:bk commit into 5.0 tree (evgen:1.2348)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of evgen. When evgen 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, 2006-12-15 23:06:20+03:00, evgen@stripped +2 -0
  Merge epotemkin@stripped:/home/bk/mysql-5.0-opt
  into  moonbone.local:/home/evgen/bk-trees/mysql-5.0-opt
  MERGE: 1.2346.1.2

  mysql-test/t/subselect.test@stripped, 2006-12-15 23:06:18+03:00, evgen@stripped +0 -0
    Auto merged
    MERGE: 1.134.1.2

  sql/item_subselect.cc@stripped, 2006-12-15 23:06:18+03:00, evgen@stripped +0 -0
    Auto merged
    MERGE: 1.142.1.2

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	evgen
# Host:	moonbone.local
# Root:	/home/evgen/bk-trees/mysql-5.0-opt/RESYNC

--- 1.136/mysql-test/t/subselect.test	2006-12-12 17:57:47 +03:00
+++ 1.137/mysql-test/t/subselect.test	2006-12-15 23:06:18 +03:00
@@ -1988,6 +1988,18 @@
 
 DROP TABLE t1,t2,t3;
 
+#
+# Bug 24670: subquery witout tables but with a WHERE clause
+#
+
+CREATE TABLE t1 (a int);
+INSERT INTO t1 VALUES (1), (2);
+
+SELECT a FROM t1 WHERE (SELECT 1 FROM DUAL WHERE 1=0) > 0;
+SELECT a FROM t1 WHERE (SELECT 1 FROM DUAL WHERE 1=0) IS NULL;
+EXPLAIN SELECT a FROM t1 WHERE (SELECT 1 FROM DUAL WHERE 1=0) IS NULL;
+
+DROP TABLE t1;
 # End of 4.1 tests
 
 #

--- 1.144/sql/item_subselect.cc	2006-12-12 17:57:47 +03:00
+++ 1.145/sql/item_subselect.cc	2006-12-15 23:06:18 +03:00
@@ -349,6 +349,7 @@
       */
       !(select_lex->item_list.head()->type() == FIELD_ITEM ||
 	select_lex->item_list.head()->type() == REF_ITEM) &&
+      !join->conds && !join->having &&
       /*
         switch off this optimization for prepare statement,
         because we do not rollback this changes
@@ -373,8 +374,6 @@
     */
     substitution->walk(&Item::remove_dependence_processor,
 		       (byte *) select_lex->outer_select());
-    /* SELECT without FROM clause can't have WHERE or HAVING clause */
-    DBUG_ASSERT(join->conds == 0 && join->having == 0);
     return RES_REDUCE;
   }
   return RES_OK;
@@ -2274,6 +2273,22 @@
 bool subselect_single_select_engine::no_tables()
 {
   return(select_lex->table_list.elements == 0);
+}
+
+
+/*
+  Check statically whether the subquery can return NULL
+
+  SINOPSYS
+    subselect_single_select_engine::may_be_null()
+
+  RETURN
+    FALSE  can guarantee that the subquery never return NULL
+    TRUE   otherwise
+*/
+bool subselect_single_select_engine::may_be_null()
+{
+  return ((no_tables() && !join->conds && !join->having) ?
maybe_null : 1);
 }
 
 
Thread
bk commit into 5.0 tree (evgen:1.2348)eugene16 Dec