[Commits] Rev 3361: Fixed the following problem: the syntax of the ANALYZE command did not in file:///home/igor/maria/maria-5.5-mwl248/

Igor Babaev igor at askmonty.org
Sun Aug 19 08:18:47 EEST 2012


At file:///home/igor/maria/maria-5.5-mwl248/

------------------------------------------------------------
revno: 3361
revision-id: igor at askmonty.org-20120819051846-7ygh43o2rnfods3h
parent: igor at askmonty.org-20120818184914-ffcz647unaf5octf
committer: Igor Babaev <igor at askmonty.org>
branch nick: maria-5.5-mwl248
timestamp: Sat 2012-08-18 22:18:46 -0700
message:
  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'.
-------------- next part --------------
=== modified file 'mysql-test/r/statistics.result'
--- a/mysql-test/r/statistics.result	2012-07-11 05:12:23 +0000
+++ b/mysql-test/r/statistics.result	2012-08-19 05:18:46 +0000
@@ -893,6 +893,25 @@
 test	t1	idx4	1	6.2000
 test	t1	idx4	2	1.6875
 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.column_stat;
 DELETE FROM mysql.index_stat;

=== modified file 'mysql-test/t/statistics.test'
--- a/mysql-test/t/statistics.test	2012-07-11 05:12:23 +0000
+++ b/mysql-test/t/statistics.test	2012-08-19 05:18:46 +0000
@@ -353,6 +353,11 @@
 SELECT * FROM mysql.column_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.column_stat;
 DELETE FROM mysql.index_stat;

=== modified file 'sql/sql_yacc.yy'
--- a/sql/sql_yacc.yy	2012-08-14 19:42:14 +0000
+++ b/sql/sql_yacc.yy	2012-08-19 05:18:46 +0000
@@ -1597,7 +1597,7 @@
         analyze_table_list analyze_table_elem_spec
         opt_persistent_stat_clause persistent_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
         field_list field_list_item field_spec kill column_def key_def
         keycache_list keycache_list_or_parts assign_to_keycache
@@ -7312,18 +7312,25 @@
 table_index_list:
           /* empty */
           {}
-        | ident 
-          {
-            Lex->index_list->push_back((LEX_STRING*)
-            sql_memdup(&$1, sizeof(LEX_STRING)));
-          }
-        | table_index_list ',' ident
-          {
-            Lex->index_list->push_back((LEX_STRING*)
-            sql_memdup(&$3, sizeof(LEX_STRING)));
-          }
+        | table_index_name 
+        | table_index_list ',' table_index_name
         ;
 
+table_index_name:
+          ident
+          {
+            Lex->index_list->push_back(
+              (LEX_STRING*) sql_memdup(&$1, sizeof(LEX_STRING)));
+          }
+        |
+          PRIMARY_SYM
+          {
+            LEX_STRING str= {(char*) "PRIMARY", 7};
+            Lex->index_list->push_back(
+              (LEX_STRING*) sql_memdup(&str, sizeof(LEX_STRING)));
+          }  
+        ;  
+
 binlog_base64_event:
           BINLOG_SYM TEXT_STRING_sys
           {



More information about the commits mailing list