MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Gleb Shchepa Date:September 18 2008 12:33pm
Subject:bzr push into mysql-5.1 branch (gshchepa:2686 to 2687) Bug#26020
View as plain text  
 2687 Gleb Shchepa	2008-09-18
      Post-push fix for bug #26020: User-Defined Variables are not consistence with columns data types.
      
      --ps-protocol problem has been fixed.
modified:
  sql/item_func.cc

 2686 Gleb Shchepa	2008-09-18
      Bug#26020: User-Defined Variables are not consistent with
                 columns data types
      
      The "SELECT @lastId, @lastId := Id FROM t" query returns
      different result sets depending on the type of the Id column
      (INT or BIGINT).
      
      Note: this fix doesn't cover the case when a select query
      references an user variable and stored function that
      updates a value of that variable, in this case a result
      is indeterminate.
      
      
      The server uses incorrect assumption about a constantness of
      an user variable value as a select list item: 
      
      The server caches a last query number where that variable
      was changed and compares this number with a current query
      number. If these numbers are different, the server guesses,
      that the variable is not updating in the current query, so
      a respective select list item is a constant. However, in some
      common cases the server updates cached query number too late.
      
      
      The server has been modified to memorize user variable
      assignments during the parse phase to take them into account
      on the next (query preparation) phase independently of the
      order of user variable references/assignments in a select
      item list.
modified:
  mysql-test/r/user_var.result
  mysql-test/t/user_var.test
  sql/item_func.cc
  sql/item_func.h
  sql/sql_base.cc
  sql/sql_lex.cc
  sql/sql_lex.h
  sql/sql_yacc.yy

=== modified file 'sql/item_func.cc'
--- a/sql/item_func.cc	2008-09-18 08:38:44 +0000
+++ b/sql/item_func.cc	2008-09-18 12:24:09 +0000
@@ -3809,7 +3809,7 @@ static user_var_entry *get_variable(HASH
 bool Item_func_set_user_var::set_entry(THD *thd, bool create_if_not_exists)
 {
   if (thd == entry_thd && entry)
-    return FALSE;
+    goto end; // update entry->update_query_id for PS
   entry_thd= thd;
   if (!(entry= get_variable(&thd->user_vars, name, create_if_not_exists)))
     return TRUE;
@@ -3818,6 +3818,7 @@ bool Item_func_set_user_var::set_entry(T
      if this variable is a constant item in the query (it is if update_query_id
      is different from query_id).
   */
+end:
   entry->update_query_id= thd->query_id;
   return FALSE;
 }

Thread
bzr push into mysql-5.1 branch (gshchepa:2686 to 2687) Bug#26020Gleb Shchepa18 Sep