Commit d22aa74e authored by Igor Babaev's avatar Igor Babaev

Fixed the following problem: the syntax of the ANALYZE command did not

returned an error if the list of the specified index names contained
the name 'primary'.
parent 29292513
...@@ -893,6 +893,25 @@ test t1 idx2 2 2.3846 ...@@ -893,6 +893,25 @@ test t1 idx2 2 2.3846
test t1 idx4 1 6.2000 test t1 idx4 1 6.2000
test t1 idx4 2 1.6875 test t1 idx4 2 1.6875
test t1 idx4 3 1.1304 test t1 idx4 3 1.1304
DELETE FROM mysql.index_stat WHERE table_name='t1' AND index_name='primary';
SELECT * FROM mysql.index_stat;
db_name table_name index_name prefix_arity avg_frequency
test t1 idx2 1 7.0000
test t1 idx2 2 2.3846
test t1 idx4 1 6.2000
test t1 idx4 2 1.6875
test t1 idx4 3 1.1304
ANALYZE TABLE t1 PERSISTENT FOR COLUMNS() INDEXES(primary);
Table Op Msg_type Msg_text
test.t1 analyze status Table is already up to date
SELECT * FROM mysql.index_stat;
db_name table_name index_name prefix_arity avg_frequency
test t1 idx2 1 7.0000
test t1 idx2 2 2.3846
test t1 idx4 1 6.2000
test t1 idx4 2 1.6875
test t1 idx4 3 1.1304
test t1 PRIMARY 1 1.0000
DELETE FROM mysql.table_stat; DELETE FROM mysql.table_stat;
DELETE FROM mysql.column_stat; DELETE FROM mysql.column_stat;
DELETE FROM mysql.index_stat; DELETE FROM mysql.index_stat;
......
...@@ -353,6 +353,11 @@ SELECT * FROM mysql.table_stat; ...@@ -353,6 +353,11 @@ SELECT * FROM mysql.table_stat;
SELECT * FROM mysql.column_stat; SELECT * FROM mysql.column_stat;
SELECT * FROM mysql.index_stat; SELECT * FROM mysql.index_stat;
DELETE FROM mysql.index_stat WHERE table_name='t1' AND index_name='primary';
SELECT * FROM mysql.index_stat;
ANALYZE TABLE t1 PERSISTENT FOR COLUMNS() INDEXES(primary);
SELECT * FROM mysql.index_stat;
DELETE FROM mysql.table_stat; DELETE FROM mysql.table_stat;
DELETE FROM mysql.column_stat; DELETE FROM mysql.column_stat;
DELETE FROM mysql.index_stat; DELETE FROM mysql.index_stat;
......
...@@ -1597,7 +1597,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); ...@@ -1597,7 +1597,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
analyze_table_list analyze_table_elem_spec analyze_table_list analyze_table_elem_spec
opt_persistent_stat_clause persistent_stat_spec opt_persistent_stat_clause persistent_stat_spec
persistent_column_stat_spec persistent_index_stat_spec persistent_column_stat_spec persistent_index_stat_spec
table_column_list table_index_list table_column_list table_index_list table_index_name
check start checksum check start checksum
field_list field_list_item field_spec kill column_def key_def field_list field_list_item field_spec kill column_def key_def
keycache_list keycache_list_or_parts assign_to_keycache keycache_list keycache_list_or_parts assign_to_keycache
...@@ -7312,17 +7312,24 @@ table_column_list: ...@@ -7312,17 +7312,24 @@ table_column_list:
table_index_list: table_index_list:
/* empty */ /* empty */
{} {}
| ident | table_index_name
| table_index_list ',' table_index_name
;
table_index_name:
ident
{ {
Lex->index_list->push_back((LEX_STRING*) Lex->index_list->push_back(
sql_memdup(&$1, sizeof(LEX_STRING))); (LEX_STRING*) sql_memdup(&$1, sizeof(LEX_STRING)));
} }
| table_index_list ',' ident |
PRIMARY_SYM
{ {
Lex->index_list->push_back((LEX_STRING*) LEX_STRING str= {(char*) "PRIMARY", 7};
sql_memdup(&$3, sizeof(LEX_STRING))); Lex->index_list->push_back(
} (LEX_STRING*) sql_memdup(&str, sizeof(LEX_STRING)));
; }
;
binlog_base64_event: binlog_base64_event:
BINLOG_SYM TEXT_STRING_sys BINLOG_SYM TEXT_STRING_sys
......
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