summaryrefslogtreecommitdiff
path: root/sql/sql_yacc.yy
diff options
context:
space:
mode:
authorAlexander Nozdrin <alik@sun.com>2010-02-02 16:38:44 +0300
committerAlexander Nozdrin <alik@sun.com>2010-02-02 16:38:44 +0300
commit59f1be1b636e360c410c81de1c41a8c4a254077d (patch)
treef9c8abdf7dad923c0137a358559ba46ba23e2c61 /sql/sql_yacc.yy
parent2db684572ea716de462bf8d79f398dfcc130a8ff (diff)
downloadmariadb-git-59f1be1b636e360c410c81de1c41a8c4a254077d.tar.gz
Revert a patch for Bug#48231, which introduced valgrind warnings.
Original revision: ------------------------------------------------------------ revision-id: li-bing.song@sun.com-20100130124925-o6sfex42b6noyc6x parent: joro@sun.com-20100129145427-0n79l9hnk0q43ajk committer: <Li-Bing.Song@sun.com> branch nick: mysql-5.1-bugteam timestamp: Sat 2010-01-30 20:49:25 +0800 message: Bug #48321 CURRENT_USER() incorrectly replicated for DROP/RENAME USER; REVOKE/GRANT; ALTER EVENT. The following statements support the CURRENT_USER() where a user is needed. DROP USER RENAME USER CURRENT_USER() ... GRANT ... TO CURRENT_USER() REVOKE ... FROM CURRENT_USER() ALTER DEFINER = CURRENT_USER() EVENT but, When these statements are binlogged, CURRENT_USER() just is binlogged as 'CURRENT_USER()', it is not expanded to the real user name. When slave executes the log event, 'CURRENT_USER()' is expand to the user of slave SQL thread, but SQL thread's user name always NULL. This breaks the replication. After this patch, All above statements are rewritten when they are binlogged. The CURRENT_USER() is expanded to the real user's name and host. ------------------------------------------------------------
Diffstat (limited to 'sql/sql_yacc.yy')
-rw-r--r--sql/sql_yacc.yy36
1 files changed, 7 insertions, 29 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 92c4de5b462..8dc08f8425f 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -1562,11 +1562,7 @@ opt_end_of_input:
;
verb_clause:
- remember_name statement remember_end
- {
- Lex->stmt_begin= $1;
- Lex->stmt_end= $3;
- }
+ statement
| begin
;
@@ -5747,7 +5743,7 @@ alter:
}
view_tail
{}
- | ALTER definer_opt remember_name EVENT_SYM sp_name
+ | ALTER definer_opt EVENT_SYM sp_name
{
/*
It is safe to use Lex->spname because
@@ -5759,8 +5755,7 @@ alter:
if (!(Lex->event_parse_data= Event_parse_data::new_instance(YYTHD)))
MYSQL_YYABORT;
- Lex->event_parse_data->identifier= $5;
- Lex->stmt_definition_begin= $3;
+ Lex->event_parse_data->identifier= $4;
Lex->sql_command= SQLCOM_ALTER_EVENT;
}
@@ -5770,7 +5765,7 @@ alter:
opt_ev_comment
opt_ev_sql_stmt
{
- if (!($7 || $8 || $9 || $10 || $11))
+ if (!($6 || $7 || $8 || $9 || $10))
{
my_parse_error(ER(ER_SYNTAX_ERROR));
MYSQL_YYABORT;
@@ -5831,16 +5826,7 @@ opt_ev_rename_to:
;
opt_ev_sql_stmt:
- /* empty*/
- {
- $$= 0;
- /*
- Lex->sp_head is not initialized when event body is empty.
- So we can not use Lex->sp_head->set_stmt_end() to set
- stmt_definition_end.
- */
- Lex->stmt_definition_end= (char*) YYLIP->get_cpp_tok_end();
- }
+ /* empty*/ { $$= 0;}
| DO_SYM ev_sql_stmt { $$= 1; }
;
@@ -11530,7 +11516,6 @@ user:
$$->user = $1;
$$->host.str= (char *) "%";
$$->host.length= 1;
- Lex->stmt_user_end= YYLIP->get_cpp_ptr();
if (check_string_char_length(&$$->user, ER(ER_USERNAME),
USERNAME_CHAR_LENGTH,
@@ -11543,7 +11528,6 @@ user:
if (!($$=(LEX_USER*) thd->alloc(sizeof(st_lex_user))))
MYSQL_YYABORT;
$$->user = $1; $$->host=$3;
- Lex->stmt_user_end= YYLIP->get_cpp_ptr();
if (check_string_char_length(&$$->user, ER(ER_USERNAME),
USERNAME_CHAR_LENGTH,
@@ -11553,7 +11537,6 @@ user:
}
| CURRENT_USER optional_braces
{
- Lex->stmt_user_end= YYLIP->get_cpp_ptr();
if (!($$=(LEX_USER*) YYTHD->alloc(sizeof(st_lex_user))))
MYSQL_YYABORT;
/*
@@ -12744,10 +12727,9 @@ user_list:
;
grant_list:
- { Lex->stmt_user_begin= YYLIP->get_cpp_ptr(); }
grant_user
{
- if (Lex->users_list.push_back($2))
+ if (Lex->users_list.push_back($1))
MYSQL_YYABORT;
}
| grant_list ',' grant_user
@@ -12760,7 +12742,6 @@ grant_list:
grant_user:
user IDENTIFIED_SYM BY TEXT_STRING
{
- Lex->stmt_user_end= YYLIP->get_cpp_ptr();
$$=$1; $1->password=$4;
if ($4.length)
{
@@ -12787,10 +12768,7 @@ grant_user:
}
}
| user IDENTIFIED_SYM BY PASSWORD TEXT_STRING
- {
- Lex->stmt_user_end= YYLIP->get_cpp_ptr();
- $$= $1; $1->password= $5;
- }
+ { $$= $1; $1->password= $5; }
| user
{ $$= $1; $1->password= null_lex_str; }
;