Commit 184c7c7e authored by unknown's avatar unknown

Merge sgluhov@bk-internal.mysql.com:/home/bk/mysql-4.1

into gluh.mysql.r18.ru:/home/gluh/mysql-4.1.clear
parents 3b759050 d147d872
......@@ -406,3 +406,13 @@ set @a=@b, @b=@a;
select @a, @b;
@a @b
2 1
set @@global.global.key_buffer_size= 1;
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
set GLOBAL global.key_buffer_size= 1;
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
SELECT @@global.global.key_buffer_size;
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
SELECT @@global.session.key_buffer_size;
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
SELECT @@global.local.key_buffer_size;
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
......@@ -285,3 +285,17 @@ select @@global.max_user_connections,@@local.max_join_size;
set @a=1, @b=2;
set @a=@b, @b=@a;
select @a, @b;
#
# Bug#2586:Disallow global/session/local as structured var. instance names
#
--error 1149
set @@global.global.key_buffer_size= 1;
--error 1149
set GLOBAL global.key_buffer_size= 1;
--error 1149
SELECT @@global.global.key_buffer_size;
--error 1149
SELECT @@global.session.key_buffer_size;
--error 1149
SELECT @@global.local.key_buffer_size;
......@@ -29,6 +29,16 @@
#include <ft_global.h>
bool check_reserved_words(LEX_STRING *name)
{
if (!my_strcasecmp(system_charset_info, name->str, "GLOBAL") ||
!my_strcasecmp(system_charset_info, name->str, "LOCAL") ||
!my_strcasecmp(system_charset_info, name->str, "SESSION"))
return TRUE;
return FALSE;
}
static void my_coll_agg_error(DTCollation &c1, DTCollation &c2,
const char *fname)
{
......@@ -2957,6 +2967,12 @@ Item *get_system_var(THD *thd, enum_var_type var_type, LEX_STRING name,
(uint) strlen(server_version),
system_charset_info);
if (name.str && component.str && check_reserved_words(&name))
{
net_printf(thd, ER_SYNTAX_ERROR);
return 0;
}
Item *item;
sys_var *var;
char buff[MAX_SYS_VAR_LENGTH*2+4+8], *pos;
......
......@@ -751,6 +751,9 @@ bool open_log(MYSQL_LOG *log, const char *hostname,
/* mysqld.cc */
extern void yyerror(const char*);
/* item_func.cc */
extern bool check_reserved_words(LEX_STRING *name);
/* strfunc.cc */
ulonglong find_set(TYPELIB *typelib,const char *x, uint length,
char **err_pos, uint *err_len, bool *set_warning);
......
......@@ -5034,6 +5034,11 @@ internal_variable_name:
}
| ident '.' ident
{
if (check_reserved_words(&$1))
{
net_printf(YYTHD, ER_SYNTAX_ERROR);
YYABORT;
}
sys_var *tmp=find_sys_var($3.str, $3.length);
if (!tmp)
YYABORT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment