List:Internals« Previous MessageNext Message »
From:pem Date:June 1 2005 2:07pm
Subject:bk commit into 5.0 tree (pem:1.1944) BUG#5967
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.1944 05/06/01 15:42:40 pem@stripped +4 -0
  Fixed BUG#10969: Stored procedures: crash if default() function
    Return an error if default() is used on a local variable.
    This is actaully a side-effect of BUG#5967: Stored procedure declared
    variable used instead of column (to be fixed later), so this is really a
    workaround until that is fixed.

  sql/sql_yacc.yy
    1.385 05/06/01 15:42:34 pem@stripped +12 -1
    Return an error if default() is applied on a local SP variable.

  sql/item.h
    1.132 05/06/01 15:42:34 pem@stripped +7 -0
    Get name of local variable for error messages.

  mysql-test/t/sp-error.test
    1.72 05/06/01 15:42:34 pem@stripped +23 -0
    New test case for BUG#10969.

  mysql-test/r/sp-error.result
    1.70 05/06/01 15:42:34 pem@stripped +13 -0
    New test case for BUG#10969.

# 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:	mysql.comhem.se
# Root:	/home/pem/work/mysql-5.0

--- 1.131/sql/item.h	Wed May 25 23:18:20 2005
+++ 1.132/sql/item.h	Wed Jun  1 15:42:34 2005
@@ -584,6 +584,13 @@
     Item::maybe_null= TRUE;
   }
 
+  /* For error printing */
+  inline void my_name(char **strp, uint *lengthp)
+  {
+    *strp= m_name.str;
+    *lengthp= m_name.length;
+  }
+
   bool is_splocal() { return 1; } /* Needed for error checking */
 
   Item *this_item();

--- 1.384/sql/sql_yacc.yy	Mon May 30 11:06:22 2005
+++ 1.385/sql/sql_yacc.yy	Wed Jun  1 15:42:34 2005
@@ -4343,7 +4343,18 @@
 	| CONVERT_SYM '(' expr USING charset_name ')'
 	  { $$= new Item_func_conv_charset($3,$5); }
 	| DEFAULT '(' simple_ident ')'
-	  { $$= new Item_default_value($3); }
+	  {
+	    if ($3->is_splocal())
+	    {
+	      LEX_STRING name;
+	      Item_splocal *il= static_cast<Item_splocal *>($3);
+
+	      il->my_name(&name.str, &name.length);
+	      my_error(ER_WRONG_COLUMN_NAME, MYF(0), name.str);
+	      YYABORT;
+	    }
+	    $$= new Item_default_value($3);
+	  }
 	| VALUES '(' simple_ident ')'
 	  { $$= new Item_insert_value($3); }
 	| FUNC_ARG0 '(' ')'

--- 1.69/mysql-test/r/sp-error.result	Tue May 31 18:36:27 2005
+++ 1.70/mysql-test/r/sp-error.result	Wed Jun  1 15:42:34 2005
@@ -658,4 +658,17 @@
 begin
 end|
 ERROR 42000: Identifier name 'bug9529_90123456789012345678901234567890123456789012345678901234567890' is too long
+drop procedure if exists bug10969|
+create procedure bug10969()
+begin
+declare s1 int default 0;
+select default(s1) from t30;
+end|
+ERROR 42000: Incorrect column name 's1'
+create procedure bug10969()
+begin
+declare s1 int default 0;
+select default(t30.s1) from t30;
+end|
+drop procedure bug10969|
 drop table t1|

--- 1.71/mysql-test/t/sp-error.test	Tue May 31 18:36:27 2005
+++ 1.72/mysql-test/t/sp-error.test	Wed Jun  1 15:42:34 2005
@@ -931,6 +931,29 @@
 
 
 #
+# BUG#10969: Stored procedures: crash if default() function
+#
+--disable_warnings
+drop procedure if exists bug10969|
+--enable_warnings
+--error ER_WRONG_COLUMN_NAME
+create procedure bug10969()
+begin
+  declare s1 int default 0;
+  select default(s1) from t30;
+end|
+
+# This should work
+create procedure bug10969()
+begin
+  declare s1 int default 0;
+  select default(t30.s1) from t30;
+end|
+
+drop procedure bug10969|
+
+
+#
 # BUG#NNNN: New bug synopsis
 #
 #--disable_warnings
Thread
bk commit into 5.0 tree (pem:1.1944) BUG#5967pem1 Jun