Commit 18d6dd56 authored by pem@mysql.com's avatar pem@mysql.com

Fixed BUG#7088: Stored procedures: labels won't work if character set is utf8.

  We used 'IDENT' for labels as a temporary fix for the  parser conflicts
  introduced if the proper rule 'ident' was used. Now a specially tailored
  'label_ident' rule is used for labels instead.
parent e2879722
...@@ -3101,4 +3101,33 @@ call bug11529()| ...@@ -3101,4 +3101,33 @@ call bug11529()|
call bug11529()| call bug11529()|
delete from t1| delete from t1|
drop procedure bug11529| drop procedure bug11529|
drop procedure if exists bug6063|
drop procedure if exists bug7088_1|
drop procedure if exists bug7088_2|
create procedure bug6063()
lbel: begin end|
call bug6063()|
show create procedure bug6063|
Procedure sql_mode Create Procedure
bug6063 CREATE PROCEDURE `test`.`bug6063`()
l?bel: begin end
set character set utf8|
create procedure bug7088_1()
label1: begin end|
create procedure bug7088_2()
läbel1: begin end|
call bug7088_1()|
call bug7088_2()|
set character set default|
show create procedure bug7088_1|
Procedure sql_mode Create Procedure
bug7088_1 CREATE PROCEDURE `test`.`bug7088_1`()
label1: begin end
show create procedure bug7088_2|
Procedure sql_mode Create Procedure
bug7088_2 CREATE PROCEDURE `test`.`bug7088_2`()
lbel1: begin end
drop procedure bug6063|
drop procedure bug7088_1|
drop procedure bug7088_2|
drop table t1,t2; drop table t1,t2;
...@@ -3799,6 +3799,38 @@ delete from t1| ...@@ -3799,6 +3799,38 @@ delete from t1|
drop procedure bug11529| drop procedure bug11529|
#
# BUG#6063: Stored procedure labels are subject to restrictions (partial)
# BUG#7088: Stored procedures: labels won't work if character set is utf8
#
--disable_warnings
drop procedure if exists bug6063|
drop procedure if exists bug7088_1|
drop procedure if exists bug7088_2|
--enable_warnings
create procedure bug6063()
lbel: begin end|
call bug6063()|
# QQ Known bug: this will not show the label correctly.
show create procedure bug6063|
set character set utf8|
create procedure bug7088_1()
label1: begin end label1|
create procedure bug7088_2()
läbel1: begin end|
call bug7088_1()|
call bug7088_2()|
set character set default|
show create procedure bug7088_1|
show create procedure bug7088_2|
drop procedure bug6063|
drop procedure bug7088_1|
drop procedure bug7088_2|
# #
# BUG#NNNN: New bug synopsis # BUG#NNNN: New bug synopsis
# #
...@@ -3812,4 +3844,3 @@ drop procedure bug11529| ...@@ -3812,4 +3844,3 @@ drop procedure bug11529|
# practical, or create table t3, t4 etc temporarily (and drop them). # practical, or create table t3, t4 etc temporarily (and drop them).
delimiter ;| delimiter ;|
drop table t1,t2; drop table t1,t2;
...@@ -676,7 +676,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); ...@@ -676,7 +676,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
LEX_HOSTNAME ULONGLONG_NUM field_ident select_alias ident ident_or_text LEX_HOSTNAME ULONGLONG_NUM field_ident select_alias ident ident_or_text
UNDERSCORE_CHARSET IDENT_sys TEXT_STRING_sys TEXT_STRING_literal UNDERSCORE_CHARSET IDENT_sys TEXT_STRING_sys TEXT_STRING_literal
NCHAR_STRING opt_component key_cache_name NCHAR_STRING opt_component key_cache_name
sp_opt_label BIN_NUM sp_opt_label BIN_NUM label_ident
%type <lex_str_ptr> %type <lex_str_ptr>
opt_table_alias opt_table_alias
...@@ -764,7 +764,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); ...@@ -764,7 +764,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%type <udf_type> udf_func_type %type <udf_type> udf_func_type
%type <symbol> FUNC_ARG0 FUNC_ARG1 FUNC_ARG2 FUNC_ARG3 keyword %type <symbol> FUNC_ARG0 FUNC_ARG1 FUNC_ARG2 FUNC_ARG3 keyword keyword_sp
%type <lex_user> user grant_user %type <lex_user> user grant_user
...@@ -2053,7 +2053,7 @@ sp_proc_stmt: ...@@ -2053,7 +2053,7 @@ sp_proc_stmt:
lex->sphead->backpatch(lex->spcont->pop_label()); lex->sphead->backpatch(lex->spcont->pop_label());
} }
| LEAVE_SYM IDENT | LEAVE_SYM label_ident
{ {
LEX *lex= Lex; LEX *lex= Lex;
sp_head *sp = lex->sphead; sp_head *sp = lex->sphead;
...@@ -2083,7 +2083,7 @@ sp_proc_stmt: ...@@ -2083,7 +2083,7 @@ sp_proc_stmt:
sp->add_instr(i); sp->add_instr(i);
} }
} }
| ITERATE_SYM IDENT | ITERATE_SYM label_ident
{ {
LEX *lex= Lex; LEX *lex= Lex;
sp_head *sp= lex->sphead; sp_head *sp= lex->sphead;
...@@ -2400,7 +2400,7 @@ sp_whens: ...@@ -2400,7 +2400,7 @@ sp_whens:
; ;
sp_labeled_control: sp_labeled_control:
IDENT ':' label_ident ':'
{ {
LEX *lex= Lex; LEX *lex= Lex;
sp_pcontext *ctx= lex->spcont; sp_pcontext *ctx= lex->spcont;
...@@ -2439,7 +2439,7 @@ sp_labeled_control: ...@@ -2439,7 +2439,7 @@ sp_labeled_control:
sp_opt_label: sp_opt_label:
/* Empty */ { $$= null_lex_str; } /* Empty */ { $$= null_lex_str; }
| IDENT { $$= $1; } | label_ident { $$= $1; }
; ;
sp_unlabeled_control: sp_unlabeled_control:
...@@ -7295,6 +7295,16 @@ ident: ...@@ -7295,6 +7295,16 @@ ident:
} }
; ;
label_ident:
IDENT_sys { $$=$1; }
| keyword_sp
{
THD *thd= YYTHD;
$$.str= thd->strmake($1.str, $1.length);
$$.length= $1.length;
}
;
ident_or_text: ident_or_text:
ident { $$=$1;} ident { $$=$1;}
| TEXT_STRING_sys { $$=$1;} | TEXT_STRING_sys { $$=$1;}
...@@ -7336,9 +7346,51 @@ user: ...@@ -7336,9 +7346,51 @@ user:
} }
}; };
/* Keyword that we allow for identifiers */ /* Keyword that we allow for identifiers (except SP labels) */
keyword: keyword:
keyword_sp {}
| ASCII_SYM {}
| BACKUP_SYM {}
| BEGIN_SYM {}
| BYTE_SYM {}
| CACHE_SYM {}
| CHARSET {}
| CHECKSUM_SYM {}
| CLOSE_SYM {}
| COMMENT_SYM {}
| COMMIT_SYM {}
| CONTAINS_SYM {}
| DEALLOCATE_SYM {}
| DO_SYM {}
| END {}
| EXECUTE_SYM {}
| FLUSH_SYM {}
| HANDLER_SYM {}
| HELP_SYM {}
| LANGUAGE_SYM {}
| NO_SYM {}
| OPEN_SYM {}
| PREPARE_SYM {}
| REPAIR {}
| RESET_SYM {}
| RESTORE_SYM {}
| ROLLBACK_SYM {}
| SAVEPOINT_SYM {}
| SECURITY_SYM {}
| SIGNED_SYM {}
| SLAVE {}
| START_SYM {}
| STOP_SYM {}
| TRUNCATE_SYM {}
| UNICODE_SYM {}
| XA_SYM {}
;
/*
* Keywords that we allow for labels in SPs.
* Anything that's the beginning of a statement must be in keyword above.
*/
keyword_sp:
ACTION {} ACTION {}
| ADDDATE_SYM {} | ADDDATE_SYM {}
| AFTER_SYM {} | AFTER_SYM {}
...@@ -7346,61 +7398,46 @@ keyword: ...@@ -7346,61 +7398,46 @@ keyword:
| AGGREGATE_SYM {} | AGGREGATE_SYM {}
| ALGORITHM_SYM {} | ALGORITHM_SYM {}
| ANY_SYM {} | ANY_SYM {}
| ASCII_SYM {}
| AUTO_INC {} | AUTO_INC {}
| AVG_ROW_LENGTH {} | AVG_ROW_LENGTH {}
| AVG_SYM {} | AVG_SYM {}
| BACKUP_SYM {}
| BEGIN_SYM {}
| BERKELEY_DB_SYM {} | BERKELEY_DB_SYM {}
| BINLOG_SYM {} | BINLOG_SYM {}
| BIT_SYM {} | BIT_SYM {}
| BOOL_SYM {} | BOOL_SYM {}
| BOOLEAN_SYM {} | BOOLEAN_SYM {}
| BYTE_SYM {}
| BTREE_SYM {} | BTREE_SYM {}
| CACHE_SYM {}
| CASCADED {} | CASCADED {}
| CHAIN_SYM {} | CHAIN_SYM {}
| CHANGED {} | CHANGED {}
| CHARSET {}
| CHECKSUM_SYM {}
| CIPHER_SYM {} | CIPHER_SYM {}
| CLIENT_SYM {} | CLIENT_SYM {}
| CLOSE_SYM {}
| COLLATION_SYM {} | COLLATION_SYM {}
| COLUMNS {} | COLUMNS {}
| COMMENT_SYM {}
| COMMITTED_SYM {} | COMMITTED_SYM {}
| COMMIT_SYM {}
| COMPACT_SYM {} | COMPACT_SYM {}
| COMPRESSED_SYM {} | COMPRESSED_SYM {}
| CONCURRENT {} | CONCURRENT {}
| CONSISTENT_SYM {} | CONSISTENT_SYM {}
| CONTAINS_SYM {}
| CUBE_SYM {} | CUBE_SYM {}
| DATA_SYM {} | DATA_SYM {}
| DATETIME {} | DATETIME {}
| DATE_SYM {} | DATE_SYM {}
| DAY_SYM {} | DAY_SYM {}
| DEALLOCATE_SYM {}
| DEFINER_SYM {} | DEFINER_SYM {}
| DELAY_KEY_WRITE_SYM {} | DELAY_KEY_WRITE_SYM {}
| DES_KEY_FILE {} | DES_KEY_FILE {}
| DIRECTORY_SYM {} | DIRECTORY_SYM {}
| DISCARD {} | DISCARD {}
| DO_SYM {}
| DUMPFILE {} | DUMPFILE {}
| DUPLICATE_SYM {} | DUPLICATE_SYM {}
| DYNAMIC_SYM {} | DYNAMIC_SYM {}
| END {}
| ENUM {} | ENUM {}
| ENGINE_SYM {} | ENGINE_SYM {}
| ENGINES_SYM {} | ENGINES_SYM {}
| ERRORS {} | ERRORS {}
| ESCAPE_SYM {} | ESCAPE_SYM {}
| EVENTS_SYM {} | EVENTS_SYM {}
| EXECUTE_SYM {}
| EXPANSION_SYM {} | EXPANSION_SYM {}
| EXTENDED_SYM {} | EXTENDED_SYM {}
| FAST_SYM {} | FAST_SYM {}
...@@ -7411,16 +7448,13 @@ keyword: ...@@ -7411,16 +7448,13 @@ keyword:
| FILE_SYM {} | FILE_SYM {}
| FIRST_SYM {} | FIRST_SYM {}
| FIXED_SYM {} | FIXED_SYM {}
| FLUSH_SYM {}
| FRAC_SECOND_SYM {} | FRAC_SECOND_SYM {}
| GEOMETRY_SYM {} | GEOMETRY_SYM {}
| GEOMETRYCOLLECTION {} | GEOMETRYCOLLECTION {}
| GET_FORMAT {} | GET_FORMAT {}
| GRANTS {} | GRANTS {}
| GLOBAL_SYM {} | GLOBAL_SYM {}
| HANDLER_SYM {}
| HASH_SYM {} | HASH_SYM {}
| HELP_SYM {}
| HOSTS_SYM {} | HOSTS_SYM {}
| HOUR_SYM {} | HOUR_SYM {}
| IDENTIFIED_SYM {} | IDENTIFIED_SYM {}
...@@ -7432,7 +7466,6 @@ keyword: ...@@ -7432,7 +7466,6 @@ keyword:
| INNOBASE_SYM {} | INNOBASE_SYM {}
| INSERT_METHOD {} | INSERT_METHOD {}
| RELAY_THREAD {} | RELAY_THREAD {}
| LANGUAGE_SYM {}
| LAST_SYM {} | LAST_SYM {}
| LEAVES {} | LEAVES {}
| LEVEL_SYM {} | LEVEL_SYM {}
...@@ -7480,21 +7513,18 @@ keyword: ...@@ -7480,21 +7513,18 @@ keyword:
| NDBCLUSTER_SYM {} | NDBCLUSTER_SYM {}
| NEXT_SYM {} | NEXT_SYM {}
| NEW_SYM {} | NEW_SYM {}
| NO_SYM {}
| NONE_SYM {} | NONE_SYM {}
| NVARCHAR_SYM {} | NVARCHAR_SYM {}
| OFFSET_SYM {} | OFFSET_SYM {}
| OLD_PASSWORD {} | OLD_PASSWORD {}
| ONE_SHOT_SYM {} | ONE_SHOT_SYM {}
| ONE_SYM {} | ONE_SYM {}
| OPEN_SYM {}
| PACK_KEYS_SYM {} | PACK_KEYS_SYM {}
| PARTIAL {} | PARTIAL {}
| PASSWORD {} | PASSWORD {}
| PHASE_SYM {} | PHASE_SYM {}
| POINT_SYM {} | POINT_SYM {}
| POLYGON {} | POLYGON {}
| PREPARE_SYM {}
| PREV_SYM {} | PREV_SYM {}
| PRIVILEGES {} | PRIVILEGES {}
| PROCESS {} | PROCESS {}
...@@ -7512,41 +7542,31 @@ keyword: ...@@ -7512,41 +7542,31 @@ keyword:
| RELAY_LOG_FILE_SYM {} | RELAY_LOG_FILE_SYM {}
| RELAY_LOG_POS_SYM {} | RELAY_LOG_POS_SYM {}
| RELOAD {} | RELOAD {}
| REPAIR {}
| REPEATABLE_SYM {} | REPEATABLE_SYM {}
| REPLICATION {} | REPLICATION {}
| RESET_SYM {}
| RESOURCES {} | RESOURCES {}
| RESTORE_SYM {}
| RESUME_SYM {} | RESUME_SYM {}
| RETURNS_SYM {} | RETURNS_SYM {}
| ROLLBACK_SYM {}
| ROLLUP_SYM {} | ROLLUP_SYM {}
| ROUTINE_SYM {} | ROUTINE_SYM {}
| ROWS_SYM {} | ROWS_SYM {}
| ROW_FORMAT_SYM {} | ROW_FORMAT_SYM {}
| ROW_SYM {} | ROW_SYM {}
| RTREE_SYM {} | RTREE_SYM {}
| SAVEPOINT_SYM {}
| SECOND_SYM {} | SECOND_SYM {}
| SECURITY_SYM {}
| SERIAL_SYM {} | SERIAL_SYM {}
| SERIALIZABLE_SYM {} | SERIALIZABLE_SYM {}
| SESSION_SYM {} | SESSION_SYM {}
| SIGNED_SYM {}
| SIMPLE_SYM {} | SIMPLE_SYM {}
| SHARE_SYM {} | SHARE_SYM {}
| SHUTDOWN {} | SHUTDOWN {}
| SLAVE {}
| SNAPSHOT_SYM {} | SNAPSHOT_SYM {}
| SOUNDS_SYM {} | SOUNDS_SYM {}
| SQL_CACHE_SYM {} | SQL_CACHE_SYM {}
| SQL_BUFFER_RESULT {} | SQL_BUFFER_RESULT {}
| SQL_NO_CACHE_SYM {} | SQL_NO_CACHE_SYM {}
| SQL_THREAD {} | SQL_THREAD {}
| START_SYM {}
| STATUS_SYM {} | STATUS_SYM {}
| STOP_SYM {}
| STORAGE_SYM {} | STORAGE_SYM {}
| STRING_SYM {} | STRING_SYM {}
| SUBDATE_SYM {} | SUBDATE_SYM {}
...@@ -7559,7 +7579,6 @@ keyword: ...@@ -7559,7 +7579,6 @@ keyword:
| TEMPTABLE_SYM {} | TEMPTABLE_SYM {}
| TEXT_SYM {} | TEXT_SYM {}
| TRANSACTION_SYM {} | TRANSACTION_SYM {}
| TRUNCATE_SYM {}
| TIMESTAMP {} | TIMESTAMP {}
| TIMESTAMP_ADD {} | TIMESTAMP_ADD {}
| TIMESTAMP_DIFF {} | TIMESTAMP_DIFF {}
...@@ -7570,7 +7589,6 @@ keyword: ...@@ -7570,7 +7589,6 @@ keyword:
| FUNCTION_SYM {} | FUNCTION_SYM {}
| UNCOMMITTED_SYM {} | UNCOMMITTED_SYM {}
| UNDEFINED_SYM {} | UNDEFINED_SYM {}
| UNICODE_SYM {}
| UNKNOWN_SYM {} | UNKNOWN_SYM {}
| UNTIL_SYM {} | UNTIL_SYM {}
| USER {} | USER {}
...@@ -7582,7 +7600,6 @@ keyword: ...@@ -7582,7 +7600,6 @@ keyword:
| WEEK_SYM {} | WEEK_SYM {}
| WORK_SYM {} | WORK_SYM {}
| X509_SYM {} | X509_SYM {}
| XA_SYM {}
| YEAR_SYM {} | YEAR_SYM {}
; ;
......
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