MySQL Lists are EOL. Please join:

List:Internals« Previous MessageNext Message »
From:igor Date:July 17 2005 4:46pm
Subject:bk commit into 4.1 tree (igor:1.2337) BUG#11745
View as plain text  
Below is the list of changes that have just been committed into a local
4.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
  1.2337 05/07/17 09:46:14 igor@stripped +4 -0
  select.result, select.test:
    Added a test case for bug #11745.
  sql_select.cc:
    Fixed bug # 11745.
    Added support of where clause for queries with FROM DUAL.
  sql_yacc.yy:
    Fixed bug # 11745.
    Added optional where clause for queries with FROM DUAL.

  mysql-test/r/select.result
    1.61 05/07/17 09:45:33 igor@stripped +16 -0
    Added a test case for bug #11745.

  mysql-test/t/select.test
    1.44 05/07/17 09:44:59 igor@stripped +18 -0
    Added a test case for bug #11745.

  sql/sql_select.cc
    1.421 05/07/17 09:43:50 igor@stripped +1 -1
    Fixed bug # 11745.
    Added support of where clause for queries with FROM DUAL.

  sql/sql_yacc.yy
    1.390 05/07/17 09:42:13 igor@stripped +1 -1
    Fixed bug # 11745.
    Added optional where clause for queries with FROM DUAL.

# 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:	igor
# Host:	rurik.mysql.com
# Root:	/home/igor/dev/mysql-4.1-0

--- 1.420/sql/sql_select.cc	Sat Jul 16 18:28:02 2005
+++ 1.421/sql/sql_select.cc	Sun Jul 17 09:43:50 2005
@@ -1072,7 +1072,7 @@
     else
     {
       result->send_fields(fields_list,1);
-      if (!having || having->val_int())
+      if (cond_value != Item::COND_FALSE && (!having || having->val_int()))
       {
 	if (do_send_rows && (procedure ? (procedure->send_row(fields_list) ||
                                           procedure->end_of_records())

--- 1.389/sql/sql_yacc.yy	Thu Jul 14 13:01:41 2005
+++ 1.390/sql/sql_yacc.yy	Sun Jul 17 09:42:13 2005
@@ -2459,7 +2459,7 @@
 select_from:
 	  FROM join_table_list where_clause group_clause having_clause
 	       opt_order_clause opt_limit_clause procedure_clause
-        | FROM DUAL_SYM opt_limit_clause
+        | FROM DUAL_SYM where_clause opt_limit_clause
           /* oracle compatibility: oracle always requires FROM clause,
              and DUAL is system table without fields.
              Is "SELECT 1 FROM DUAL" any better than "SELECT 1" ?

--- 1.60/mysql-test/r/select.result	Sat Jul 16 00:29:57 2005
+++ 1.61/mysql-test/r/select.result	Sun Jul 17 09:45:33 2005
@@ -2582,3 +2582,19 @@
 254
 255
 drop table t2;
+CREATE TABLE t1 (a int, b int, c int);
+INSERT INTO t1
+SELECT 50, 3, 3 FROM DUAL
+WHERE NOT EXISTS
+(SELECT * FROM t1 WHERE a = 50 AND b = 3);
+SELECT * FROM t1;
+a	b	c
+50	3	3
+INSERT INTO t1
+SELECT 50, 3, 3 FROM DUAL
+WHERE NOT EXISTS
+(SELECT * FROM t1 WHERE a = 50 AND b = 3);
+SELECT * FROM t1;
+a	b	c
+50	3	3
+DROP TABLE t1;

--- 1.43/mysql-test/t/select.test	Sat Jul 16 00:29:57 2005
+++ 1.44/mysql-test/t/select.test	Sun Jul 17 09:44:59 2005
@@ -2138,3 +2138,21 @@
 explain select * from t2 where a > -1;
 select * from t2 where a > -1;
 drop table t2;
+
+#
+# Bug #11745: SELECT ... FROM DUAL with WHERE condition
+#
+
+CREATE TABLE t1 (a int, b int, c int);
+INSERT INTO t1
+  SELECT 50, 3, 3 FROM DUAL
+    WHERE NOT EXISTS
+      (SELECT * FROM t1 WHERE a = 50 AND b = 3);
+SELECT * FROM t1;
+INSERT INTO t1
+  SELECT 50, 3, 3 FROM DUAL
+    WHERE NOT EXISTS
+      (SELECT * FROM t1 WHERE a = 50 AND b = 3);
+SELECT * FROM t1;
+
+DROP TABLE t1;
Thread
bk commit into 4.1 tree (igor:1.2337) BUG#11745igor17 Jul