diff options
-rw-r--r-- | mysql-test/r/myisam.result | 6 | ||||
-rw-r--r-- | mysql-test/t/myisam.test | 10 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 23 |
3 files changed, 37 insertions, 2 deletions
diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index 71cb76fe844..3501283cc62 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -1274,3 +1274,9 @@ show keys from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment t1 1 a 1 a A 8 NULL NULL YES BTREE drop table t1; +create table t1 (c1 int) engine=myisam pack_keys=0; +create table t2 (c1 int) engine=myisam pack_keys=1; +create table t3 (c1 int) engine=myisam pack_keys=default; +create table t4 (c1 int) engine=myisam pack_keys=2; +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 '2' at line 1 +drop table t1, t2, t3; diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index dfb00d5686c..a1ccdccb8c3 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -675,4 +675,14 @@ show keys from t1; drop table t1; +# +# Bug#10056 - PACK_KEYS option take values greater than 1 while creating table +# +create table t1 (c1 int) engine=myisam pack_keys=0; +create table t2 (c1 int) engine=myisam pack_keys=1; +create table t3 (c1 int) engine=myisam pack_keys=default; +--error 1064 +create table t4 (c1 int) engine=myisam pack_keys=2; +drop table t1, t2, t3; + # End of 4.1 tests diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 91abcd61857..632616034a4 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -2661,8 +2661,27 @@ create_table_option: | PASSWORD opt_equal TEXT_STRING_sys { Lex->create_info.password=$3.str; Lex->create_info.used_fields|= HA_CREATE_USED_PASSWORD; } | COMMENT_SYM opt_equal TEXT_STRING_sys { Lex->create_info.comment=$3.str; Lex->create_info.used_fields|= HA_CREATE_USED_COMMENT; } | AUTO_INC opt_equal ulonglong_num { Lex->create_info.auto_increment_value=$3; Lex->create_info.used_fields|= HA_CREATE_USED_AUTO;} - | PACK_KEYS_SYM opt_equal ulong_num { Lex->create_info.table_options|= $3 ? HA_OPTION_PACK_KEYS : HA_OPTION_NO_PACK_KEYS; Lex->create_info.used_fields|= HA_CREATE_USED_PACK_KEYS;} - | PACK_KEYS_SYM opt_equal DEFAULT { Lex->create_info.table_options&= ~(HA_OPTION_PACK_KEYS | HA_OPTION_NO_PACK_KEYS); Lex->create_info.used_fields|= HA_CREATE_USED_PACK_KEYS;} + | PACK_KEYS_SYM opt_equal ulong_num + { + switch($3) { + case 0: + Lex->create_info.table_options|= HA_OPTION_NO_PACK_KEYS; + break; + case 1: + Lex->create_info.table_options|= HA_OPTION_PACK_KEYS; + break; + default: + yyerror(ER(ER_SYNTAX_ERROR)); + YYABORT; + } + Lex->create_info.used_fields|= HA_CREATE_USED_PACK_KEYS; + } + | PACK_KEYS_SYM opt_equal DEFAULT + { + Lex->create_info.table_options&= + ~(HA_OPTION_PACK_KEYS | HA_OPTION_NO_PACK_KEYS); + Lex->create_info.used_fields|= HA_CREATE_USED_PACK_KEYS; + } | CHECKSUM_SYM opt_equal ulong_num { Lex->create_info.table_options|= $3 ? HA_OPTION_CHECKSUM : HA_OPTION_NO_CHECKSUM; Lex->create_info.used_fields|= HA_CREATE_USED_CHECKSUM; } | DELAY_KEY_WRITE_SYM opt_equal ulong_num { Lex->create_info.table_options|= $3 ? HA_OPTION_DELAY_KEY_WRITE : HA_OPTION_NO_DELAY_KEY_WRITE; Lex->create_info.used_fields|= HA_CREATE_USED_DELAY_KEY_WRITE; } | ROW_FORMAT_SYM opt_equal row_types { Lex->create_info.row_type= $3; Lex->create_info.used_fields|= HA_CREATE_USED_ROW_FORMAT; } |