MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Georgi Kodinov Date:June 6 2008 1:28pm
Subject:bzr commit into mysql-5.0 branch (kgeorge:2636) Bug#36949
View as plain text  
#At file:///home/kgeorge/mysql/bzr/B36949-5.0-bugteam/

 2636 Georgi Kodinov	2008-06-06
      Bug#36949: SQL-syntax error when using FORCE INDEX(index,PRIMARY)
      
      The list rule for the key list in the parser was written in an 
      incomplete way.
      Fixed by using a designated production for the list elements.
modified:
  mysql-test/r/select.result
  mysql-test/t/select.test
  sql/sql_yacc.yy

per-file messages:
  mysql-test/r/select.result
    Bug#36949: test result
  mysql-test/t/select.test
    Bug#36949: test case
  sql/sql_yacc.yy
    Bug#36949: added a designated list member production
=== modified file 'mysql-test/r/select.result'
--- a/mysql-test/r/select.result	2008-02-18 15:18:44 +0000
+++ b/mysql-test/r/select.result	2008-06-06 13:28:08 +0000
@@ -4355,4 +4355,15 @@ Handler_read_prev	0
 Handler_read_rnd	0
 Handler_read_rnd_next	6
 DROP TABLE t1, t2;
+CREATE TABLE t1 ( a INT, b INT, PRIMARY KEY (b), INDEX (a) );
+INSERT INTO t1 VALUES (1,1),(2,2);
+SELECT * FROM t1 FORCE INDEX(a,PRIMARY) ;
+a	b
+1	1
+2	2
+SELECT * FROM t1 FORCE INDEX(PRIMARY,a) ;
+a	b
+1	1
+2	2
+DROP TABLE t1;
 End of 5.0 tests

=== modified file 'mysql-test/t/select.test'
--- a/mysql-test/t/select.test	2008-02-18 15:18:44 +0000
+++ b/mysql-test/t/select.test	2008-06-06 13:28:08 +0000
@@ -3701,4 +3701,17 @@ SELECT DISTINCT b FROM t1 LEFT JOIN t2 U
 SHOW STATUS LIKE 'Handler_read%';
 DROP TABLE t1, t2;
 
+
+#
+# Bug #36949: SQL-syntax error when using FORCE INDEX(index,PRIMARY)
+#
+
+CREATE TABLE t1 ( a INT, b INT, PRIMARY KEY (b), INDEX (a) );
+INSERT INTO t1 VALUES (1,1),(2,2);
+
+SELECT * FROM t1 FORCE INDEX(a,PRIMARY) ;
+SELECT * FROM t1 FORCE INDEX(PRIMARY,a) ;
+
+DROP TABLE t1;
+
 --echo End of 5.0 tests

=== modified file 'sql/sql_yacc.yy'
--- a/sql/sql_yacc.yy	2008-04-10 00:34:38 +0000
+++ b/sql/sql_yacc.yy	2008-06-06 13:28:08 +0000
@@ -6029,19 +6029,22 @@ key_list_or_empty:
 	| key_usage_list2	{}
 	;
 
+key_usage_element:
+        ident 
+        {
+          Select->interval_list.push_back(new (YYTHD->mem_root)
+            String((const char*) $1.str, $1.length, system_charset_info));
+        }
+        | PRIMARY_SYM
+        {
+          Select->interval_list.push_back(new (YYTHD->mem_root) 
+            String("PRIMARY", 7, system_charset_info));
+        };
+
 key_usage_list2:
-	key_usage_list2 ',' ident
-        { Select->
-	    interval_list.push_back(new (YYTHD->mem_root) String((const char*) $3.str, $3.length,
-				    system_charset_info)); }
-	| ident
-        { Select->
-	    interval_list.push_back(new (YYTHD->mem_root) String((const char*) $1.str, $1.length,
-				    system_charset_info)); }
-	| PRIMARY_SYM
-        { Select->
-	    interval_list.push_back(new (YYTHD->mem_root) String("PRIMARY", 7,
-				    system_charset_info)); };
+	key_usage_list2 ',' key_usage_element {}
+	| key_usage_element {}
+        ;
 
 using_list:
 	ident

Thread
bzr commit into mysql-5.0 branch (kgeorge:2636) Bug#36949Georgi Kodinov6 Jun