MySQL Lists are EOL. Please join:

List:Internals« Previous MessageNext Message »
From:gluh Date:March 29 2005 10:29am
Subject:bk commit into 4.1 tree (gluh:1.2128) BUG#9286
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of gluh. When gluh 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.2128 05/03/29 14:29:08 gluh@stripped +3 -0
  Fix fro bug #9286: SESSION/GLOBAL should be disallowed for user variables

  sql/sql_yacc.yy
    1.380 05/03/29 14:28:03 gluh@stripped +39 -27
    Fix fro bug #9286: SESSION/GLOBAL should be disallowed for user variables

  mysql-test/t/user_var.test
    1.18 05/03/29 14:28:03 gluh@stripped +8 -0
    Fix fro bug #9286: SESSION/GLOBAL should be disallowed for user variables

  mysql-test/r/user_var.result
    1.25 05/03/29 14:28:03 gluh@stripped +4 -0
    Fix fro bug #9286: SESSION/GLOBAL should be disallowed for user variables

# 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:	gluh
# Host:	gluh.mysql.r18.ru
# Root:	/home/gluh/MySQL-BUGS/mysql-4.1.9286

--- 1.379/sql/sql_yacc.yy	Fri Feb 18 16:19:04 2005
+++ 1.380/sql/sql_yacc.yy	Tue Mar 29 14:28:03 2005
@@ -5360,17 +5360,26 @@
 	| OPTION {};
 
 option_value_list:
-	option_type option_value
-	| option_value_list ',' option_type option_value;
+        option_value_ext
+        | option_value_list ',' option_value_ext;
 
-option_type:
-	/* empty */	{}
+option_value_ext:
+        option_type_ext sys_option_value {}
+        | option_type option_value {}
+        ;
+
+option_type_ext:
+        option_type     {}
 	| GLOBAL_SYM	{ Lex->option_type= OPT_GLOBAL; }
 	| LOCAL_SYM	{ Lex->option_type= OPT_SESSION; }
 	| SESSION_SYM	{ Lex->option_type= OPT_SESSION; }
-	| ONE_SHOT_SYM	{ Lex->option_type= OPT_SESSION; Lex->one_shot_set= 1; }
 	;
 
+option_type:
+        /* empty */	{}
+        | ONE_SHOT_SYM	{ Lex->option_type= OPT_SESSION; Lex->one_shot_set= 1; }
+        ;
+
 opt_var_type:
 	/* empty */	{ $$=OPT_SESSION; }
 	| GLOBAL_SYM	{ $$=OPT_GLOBAL; }
@@ -5385,34 +5394,37 @@
 	| SESSION_SYM '.'	{ $$=OPT_SESSION; }
 	;
 
+sys_option_value:
+        internal_variable_name equal set_expr_or_default
+        {
+          LEX *lex=Lex;
+          lex->var_list.push_back(new set_var(lex->option_type, $1.var,
+                                  &$1.base_name, $3));
+        }
+        | TRANSACTION_SYM ISOLATION LEVEL_SYM isolation_types
+        {
+          LEX *lex=Lex;
+          LEX_STRING tmp;
+          tmp.str=0;
+          tmp.length=0;
+          lex->var_list.push_back(new set_var(lex->option_type,
+                                              find_sys_var("tx_isolation"),
+                                              &tmp,
+                                              new Item_int((int32) $4)));
+        }
+        ;
+
 option_value:
 	'@' ident_or_text equal expr
 	{
 	  Lex->var_list.push_back(new set_var_user(new Item_func_set_user_var($2,$4)));
 	}
-	| internal_variable_name equal set_expr_or_default
-	  {
-	    LEX *lex=Lex;
-	    lex->var_list.push_back(new set_var(lex->option_type, $1.var,
-						&$1.base_name, $3));
-	  }
 	| '@' '@' opt_var_ident_type internal_variable_name equal set_expr_or_default
-	  {
-	    LEX *lex=Lex;
-	    lex->var_list.push_back(new set_var((enum_var_type) $3, $4.var,
-						&$4.base_name, $6));
-	  }
-	| TRANSACTION_SYM ISOLATION LEVEL_SYM isolation_types
-	  {
-	    LEX *lex=Lex;
-	    LEX_STRING tmp;
-	    tmp.str=0;
-	    tmp.length=0;
-	    lex->var_list.push_back(new set_var(lex->option_type,
-						find_sys_var("tx_isolation"),
-						&tmp,
-						new Item_int((int32) $4)));
-	  }
+	{
+          LEX *lex=Lex;
+          lex->var_list.push_back(new set_var((enum_var_type) $3, $4.var,
+                                  &$4.base_name, $6));
+        }
 	| charset old_or_new_charset_name_or_default
 	{
 	  THD *thd= YYTHD;

--- 1.24/mysql-test/r/user_var.result	Tue Feb 22 14:55:33 2005
+++ 1.25/mysql-test/r/user_var.result	Tue Mar 29 14:28:03 2005
@@ -193,3 +193,7 @@
 select FIELD( @var,'1it','Hit') as my_column;
 my_column
 0
+set session @honk=99;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@honk=99' at line 1
+set one_shot @honk=99;
+ERROR HY000: The SET ONE_SHOT syntax is reserved for purposes internal to the MySQL server

--- 1.17/mysql-test/t/user_var.test	Tue Feb 22 14:55:33 2005
+++ 1.18/mysql-test/t/user_var.test	Tue Mar 29 14:28:03 2005
@@ -122,3 +122,11 @@
 #
 set @var= NULL ;
 select FIELD( @var,'1it','Hit') as my_column;
+
+#
+# Bug #9286  SESSION/GLOBAL should be disallowed for user variables
+#
+--error 1064
+set session @honk=99;
+--error 1105
+set one_shot @honk=99;
Thread
bk commit into 4.1 tree (gluh:1.2128) BUG#9286gluh29 Mar