List:Commits« Previous MessageNext Message »
From:pem Date:March 28 2006 12:18pm
Subject:bk commit into 5.0 tree (pem:1.2100)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of pem. When pem 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.2100 06/03/28 14:18:47 pem@stripped +3 -0
  Merge mysql.com:/extern/mysql/bk/mysql-5.0-runtime
  into  mysql.com:/extern/mysql/5.0/bug16474/mysql-5.0-runtime

  mysql-test/r/sp.result
    1.193 06/03/28 14:18:44 pem@stripped +16 -16
    Manual merge.

  sql/sql_select.cc
    1.398 06/03/28 14:17:16 pem@stripped +0 -0
    Auto merged

  mysql-test/t/sp.test
    1.181 06/03/28 14:17:15 pem@stripped +0 -0
    Auto merged

# 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:	pem
# Host:	pem.mysql.com
# Root:	/extern/mysql/5.0/bug16474/mysql-5.0-runtime/RESYNC

--- 1.397/sql/sql_select.cc	2006-03-28 14:16:17 +02:00
+++ 1.398/sql/sql_select.cc	2006-03-28 14:17:16 +02:00
@@ -7066,7 +7066,10 @@
   if (!cond)
     cond= new Item_cond_and(eq_list);
   else
+  {
+    DBUG_ASSERT(cond->type() == Item::COND_ITEM);
     ((Item_cond *) cond)->add_at_head(&eq_list);
+  }
 
   cond->quick_fix_field();
   cond->update_used_tables();
@@ -7151,6 +7154,11 @@
       while ((item_equal= it++))
       {
         cond= eliminate_item_equal(cond, cond_equal->upper_levels, item_equal);
+        // This occurs when eliminate_item_equal() founds that cond is
+        // always false and substitues it with Item_int 0.
+        // Due to this, value of item_equal will be 0, so just return it.
+        if (cond->type() != Item::COND_ITEM)
+          break;
       }
     }
   }

--- 1.192/mysql-test/r/sp.result	2006-03-10 11:51:25 +01:00
+++ 1.193/mysql-test/r/sp.result	2006-03-28 14:18:44 +02:00
@@ -4802,4 +4802,39 @@
 3	ccc
 drop function bug13575;
 drop table t3|
+drop procedure if exists bug16474_1|
+drop procedure if exists bug16474_2|
+delete from t1|
+insert into t1 values ('c', 2), ('b', 3), ('a', 1)|
+create procedure bug16474_1()
+begin
+declare x int;
+select id from t1 order by x;
+end|
+create procedure bug16474_2(x int)
+select id from t1 order by x|
+call bug16474_1()|
+id
+c
+b
+a
+call bug16474_2(1)|
+id
+c
+b
+a
+call bug16474_2(2)|
+id
+c
+b
+a
+drop procedure bug16474_1|
+drop procedure bug16474_2|
+set @x = 2|
+select * from t1 order by @x|
+id	data
+c	2
+b	3
+a	1
+delete from t1|
 drop table t1,t2;

--- 1.180/mysql-test/t/sp.test	2006-03-10 11:50:29 +01:00
+++ 1.181/mysql-test/t/sp.test	2006-03-28 14:17:15 +02:00
@@ -5648,6 +5648,42 @@
 drop table t3|
 
 #
+# BUG#16474: SP crashed MySQL
+# (when using "order by localvar", where 'localvar' is just that.
+#
+--disable_warnings
+drop procedure if exists bug16474_1|
+drop procedure if exists bug16474_2|
+--enable_warnings
+
+delete from t1|
+insert into t1 values ('c', 2), ('b', 3), ('a', 1)|
+
+create procedure bug16474_1()
+begin
+  declare x int;
+
+  select id from t1 order by x;
+end|
+
+# This does NOT order by column index; variable is an expression.
+create procedure bug16474_2(x int)
+  select id from t1 order by x|
+
+call bug16474_1()|
+call bug16474_2(1)|
+call bug16474_2(2)|
+drop procedure bug16474_1|
+drop procedure bug16474_2|
+
+# For reference: user variables are expressions too and do not affect ordering.
+set @x = 2|
+select * from t1 order by @x|
+
+delete from t1|
+
+
+#
 # BUG#NNNN: New bug synopsis
 #
 #--disable_warnings
Thread
bk commit into 5.0 tree (pem:1.2100)pem28 Mar