From: pem Date: July 6 2005 3:07pm Subject: bk commit into 5.0 tree (pem:1.1887) BUG#7088 List-Archive: http://lists.mysql.com/internals/26725 X-Bug: 7088 Message-Id: <200507061507.j66F7gHw025370@mail.mysql.com> Below is the list of changes that have just been committed into a local 5.0 repository of pem. When pem 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.1887 05/07/06 16:37:57 pem@stripped +3 -0 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. sql/sql_yacc.yy 1.406 05/07/06 16:35:56 pem@stripped +60 -43 Make labels in stored procedures work with other character sets than latin1. Using a separate 'label_ident' rule (instead of 'ident') and splitting the 'keyword' rule into two got rid of the temporary fix of using 'IDENT' for labels (which didn't heed character sets). mysql-test/t/sp.test 1.127 05/07/06 16:35:56 pem@stripped +32 -1 New test cases for BUG#7088. mysql-test/r/sp.result 1.132 05/07/06 16:35:56 pem@stripped +29 -0 New test cases for BUG#7088. # 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: pem # Host: mysql.comhem.se # Root: /home/pem/work/mysql-5.0 --- 1.405/sql/sql_yacc.yy 2005-07-03 13:17:46 +02:00 +++ 1.406/sql/sql_yacc.yy 2005-07-06 16:35:56 +02:00 @@ -676,7 +676,7 @@ LEX_HOSTNAME ULONGLONG_NUM field_ident select_alias ident ident_or_text UNDERSCORE_CHARSET IDENT_sys TEXT_STRING_sys TEXT_STRING_literal NCHAR_STRING opt_component key_cache_name - sp_opt_label BIN_NUM + sp_opt_label BIN_NUM label_ident %type opt_table_alias @@ -764,7 +764,7 @@ %type udf_func_type -%type FUNC_ARG0 FUNC_ARG1 FUNC_ARG2 FUNC_ARG3 keyword +%type FUNC_ARG0 FUNC_ARG1 FUNC_ARG2 FUNC_ARG3 keyword keyword_sp %type user grant_user @@ -2053,7 +2053,7 @@ lex->sphead->backpatch(lex->spcont->pop_label()); } - | LEAVE_SYM IDENT + | LEAVE_SYM label_ident { LEX *lex= Lex; sp_head *sp = lex->sphead; @@ -2083,7 +2083,7 @@ sp->add_instr(i); } } - | ITERATE_SYM IDENT + | ITERATE_SYM label_ident { LEX *lex= Lex; sp_head *sp= lex->sphead; @@ -2400,7 +2400,7 @@ ; sp_labeled_control: - IDENT ':' + label_ident ':' { LEX *lex= Lex; sp_pcontext *ctx= lex->spcont; @@ -2439,7 +2439,7 @@ sp_opt_label: /* Empty */ { $$= null_lex_str; } - | IDENT { $$= $1; } + | label_ident { $$= $1; } ; sp_unlabeled_control: @@ -7295,6 +7295,16 @@ } ; +label_ident: + IDENT_sys { $$=$1; } + | keyword_sp + { + THD *thd= YYTHD; + $$.str= thd->strmake($1.str, $1.length); + $$.length= $1.length; + } + ; + ident_or_text: ident { $$=$1;} | TEXT_STRING_sys { $$=$1;} @@ -7336,9 +7346,51 @@ } }; -/* Keyword that we allow for identifiers */ - +/* Keyword that we allow for identifiers (except SP labels) */ 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 {} | ADDDATE_SYM {} | AFTER_SYM {} @@ -7346,61 +7398,46 @@ | AGGREGATE_SYM {} | ALGORITHM_SYM {} | ANY_SYM {} - | ASCII_SYM {} | AUTO_INC {} | AVG_ROW_LENGTH {} | AVG_SYM {} - | BACKUP_SYM {} - | BEGIN_SYM {} | BERKELEY_DB_SYM {} | BINLOG_SYM {} | BIT_SYM {} | BOOL_SYM {} | BOOLEAN_SYM {} - | BYTE_SYM {} | BTREE_SYM {} - | CACHE_SYM {} | CASCADED {} | CHAIN_SYM {} | CHANGED {} - | CHARSET {} - | CHECKSUM_SYM {} | CIPHER_SYM {} | CLIENT_SYM {} - | CLOSE_SYM {} | COLLATION_SYM {} | COLUMNS {} - | COMMENT_SYM {} | COMMITTED_SYM {} - | COMMIT_SYM {} | COMPACT_SYM {} | COMPRESSED_SYM {} | CONCURRENT {} | CONSISTENT_SYM {} - | CONTAINS_SYM {} | CUBE_SYM {} | DATA_SYM {} | DATETIME {} | DATE_SYM {} | DAY_SYM {} - | DEALLOCATE_SYM {} | DEFINER_SYM {} | DELAY_KEY_WRITE_SYM {} | DES_KEY_FILE {} | DIRECTORY_SYM {} | DISCARD {} - | DO_SYM {} | DUMPFILE {} | DUPLICATE_SYM {} | DYNAMIC_SYM {} - | END {} | ENUM {} | ENGINE_SYM {} | ENGINES_SYM {} | ERRORS {} | ESCAPE_SYM {} | EVENTS_SYM {} - | EXECUTE_SYM {} | EXPANSION_SYM {} | EXTENDED_SYM {} | FAST_SYM {} @@ -7411,16 +7448,13 @@ | FILE_SYM {} | FIRST_SYM {} | FIXED_SYM {} - | FLUSH_SYM {} | FRAC_SECOND_SYM {} | GEOMETRY_SYM {} | GEOMETRYCOLLECTION {} | GET_FORMAT {} | GRANTS {} | GLOBAL_SYM {} - | HANDLER_SYM {} | HASH_SYM {} - | HELP_SYM {} | HOSTS_SYM {} | HOUR_SYM {} | IDENTIFIED_SYM {} @@ -7432,7 +7466,6 @@ | INNOBASE_SYM {} | INSERT_METHOD {} | RELAY_THREAD {} - | LANGUAGE_SYM {} | LAST_SYM {} | LEAVES {} | LEVEL_SYM {} @@ -7480,21 +7513,18 @@ | NDBCLUSTER_SYM {} | NEXT_SYM {} | NEW_SYM {} - | NO_SYM {} | NONE_SYM {} | NVARCHAR_SYM {} | OFFSET_SYM {} | OLD_PASSWORD {} | ONE_SHOT_SYM {} | ONE_SYM {} - | OPEN_SYM {} | PACK_KEYS_SYM {} | PARTIAL {} | PASSWORD {} | PHASE_SYM {} | POINT_SYM {} | POLYGON {} - | PREPARE_SYM {} | PREV_SYM {} | PRIVILEGES {} | PROCESS {} @@ -7512,41 +7542,31 @@ | RELAY_LOG_FILE_SYM {} | RELAY_LOG_POS_SYM {} | RELOAD {} - | REPAIR {} | REPEATABLE_SYM {} | REPLICATION {} - | RESET_SYM {} | RESOURCES {} - | RESTORE_SYM {} | RESUME_SYM {} | RETURNS_SYM {} - | ROLLBACK_SYM {} | ROLLUP_SYM {} | ROUTINE_SYM {} | ROWS_SYM {} | ROW_FORMAT_SYM {} | ROW_SYM {} | RTREE_SYM {} - | SAVEPOINT_SYM {} | SECOND_SYM {} - | SECURITY_SYM {} | SERIAL_SYM {} | SERIALIZABLE_SYM {} | SESSION_SYM {} - | SIGNED_SYM {} | SIMPLE_SYM {} | SHARE_SYM {} | SHUTDOWN {} - | SLAVE {} | SNAPSHOT_SYM {} | SOUNDS_SYM {} | SQL_CACHE_SYM {} | SQL_BUFFER_RESULT {} | SQL_NO_CACHE_SYM {} | SQL_THREAD {} - | START_SYM {} | STATUS_SYM {} - | STOP_SYM {} | STORAGE_SYM {} | STRING_SYM {} | SUBDATE_SYM {} @@ -7559,7 +7579,6 @@ | TEMPTABLE_SYM {} | TEXT_SYM {} | TRANSACTION_SYM {} - | TRUNCATE_SYM {} | TIMESTAMP {} | TIMESTAMP_ADD {} | TIMESTAMP_DIFF {} @@ -7570,7 +7589,6 @@ | FUNCTION_SYM {} | UNCOMMITTED_SYM {} | UNDEFINED_SYM {} - | UNICODE_SYM {} | UNKNOWN_SYM {} | UNTIL_SYM {} | USER {} @@ -7582,7 +7600,6 @@ | WEEK_SYM {} | WORK_SYM {} | X509_SYM {} - | XA_SYM {} | YEAR_SYM {} ; --- 1.131/mysql-test/r/sp.result 2005-07-01 14:51:49 +02:00 +++ 1.132/mysql-test/r/sp.result 2005-07-06 16:35:56 +02:00 @@ -3101,4 +3101,33 @@ call bug11529()| delete from t1| drop procedure bug11529| +drop procedure if exists bug6063| +drop procedure if exists bug7088_1| +drop procedure if exists bug7088_2| +create procedure bug6063() +lābel: 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`() +läbel1: begin end +drop procedure bug6063| +drop procedure bug7088_1| +drop procedure bug7088_2| drop table t1,t2; --- 1.126/mysql-test/t/sp.test 2005-07-01 14:51:49 +02:00 +++ 1.127/mysql-test/t/sp.test 2005-07-06 16:35:56 +02:00 @@ -3800,6 +3800,38 @@ # +# 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() + lābel: 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 # #--disable_warnings @@ -3812,4 +3844,3 @@ # practical, or create table t3, t4 etc temporarily (and drop them). delimiter ;| drop table t1,t2; -