Below is the list of changes that have just been committed into a local
6.0 repository of malff. When malff 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@stripped, 2008-05-12 16:29:50-06:00, malff@stripped. +3 -0
Bug#35578 (Parser allows useless/illegal CREATE TABLE syntax)
Fix the (still non supported) CHECK syntax to:
- enforce that parenthesis are present in the "CHECK ( <expr> )" syntax,
per the SQL specification
- enforce that "CONSTRAINT <name>" alone, without any constraint, is illegal,
per the SQL specification
Fixing this also resolves 3 shift/reduce conflicts in the grammar.
mysql-test/r/constraints.result@stripped, 2008-05-12 16:29:45-06:00, malff@stripped. +8 -1
Bug#35578 (Parser allows useless/illegal CREATE TABLE syntax)
mysql-test/t/constraints.test@stripped, 2008-05-12 16:29:45-06:00, malff@stripped. +19 -1
Bug#35578 (Parser allows useless/illegal CREATE TABLE syntax)
sql/sql_yacc.yy@stripped, 2008-05-12 16:29:45-06:00, malff@stripped. +3 -7
Bug#35578 (Parser allows useless/illegal CREATE TABLE syntax)
diff -Nrup a/mysql-test/r/constraints.result b/mysql-test/r/constraints.result
--- a/mysql-test/r/constraints.result 2006-02-22 02:09:47 -07:00
+++ b/mysql-test/r/constraints.result 2008-05-12 16:29:45 -06:00
@@ -3,7 +3,7 @@ create table t1 (a int check (a>0));
insert into t1 values (1);
insert into t1 values (0);
drop table t1;
-create table t1 (a int ,b int, check a>b);
+create table t1 (a int, b int, check (a>b));
insert into t1 values (1,0);
insert into t1 values (0,1);
drop table t1;
@@ -27,3 +27,10 @@ t1 CREATE TABLE `t1` (
UNIQUE KEY `key_2` (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
+drop table if exists t_illegal;
+create table t_illegal (a int, b int, check a>b);
+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 'a>b)' at line 1
+create table t_illegal (a int, b int, constraint abc check a>b);
+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 'a>b)' at line 1
+create table t_illegal (a int, b int, constraint abc);
+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 ')' at line 1
diff -Nrup a/mysql-test/t/constraints.test b/mysql-test/t/constraints.test
--- a/mysql-test/t/constraints.test 2005-09-15 08:17:10 -06:00
+++ b/mysql-test/t/constraints.test 2008-05-12 16:29:45 -06:00
@@ -10,7 +10,7 @@ create table t1 (a int check (a>0));
insert into t1 values (1);
insert into t1 values (0);
drop table t1;
-create table t1 (a int ,b int, check a>b);
+create table t1 (a int, b int, check (a>b));
insert into t1 values (1,0);
insert into t1 values (0,1);
drop table t1;
@@ -29,3 +29,21 @@ show create table t1;
drop table t1;
# End of 4.1 tests
+
+#
+# Bug#35578 (Parser allows useless/illegal CREATE TABLE syntax)
+#
+
+--disable_warnings
+drop table if exists t_illegal;
+--enable_warnings
+
+--error ER_PARSE_ERROR
+create table t_illegal (a int, b int, check a>b);
+
+--error ER_PARSE_ERROR
+create table t_illegal (a int, b int, constraint abc check a>b);
+
+--error ER_PARSE_ERROR
+create table t_illegal (a int, b int, constraint abc);
+
diff -Nrup a/sql/sql_yacc.yy b/sql/sql_yacc.yy
--- a/sql/sql_yacc.yy 2008-04-21 01:30:33 -06:00
+++ b/sql/sql_yacc.yy 2008-05-12 16:29:45 -06:00
@@ -589,10 +589,10 @@ bool my_yyoverflow(short **a, YYSTYPE **
%pure_parser /* We have threads */
/*
- Currently there are 172 shift/reduce conflicts.
+ Currently there are 169 shift/reduce conflicts.
We should not introduce new conflicts any more.
*/
-%expect 172
+%expect 169
/*
Comments for TOKENS.
@@ -4760,10 +4760,6 @@ key_def:
/* Only used for ALTER TABLE. Ignored otherwise. */
lex->alter_info.flags|= ALTER_FOREIGN_KEY;
}
- | constraint opt_check_constraint
- {
- Lex->col_list.empty(); /* Alloced by sql_alloc */
- }
| opt_constraint check_constraint
{
Lex->col_list.empty(); /* Alloced by sql_alloc */
@@ -4776,7 +4772,7 @@ opt_check_constraint:
;
check_constraint:
- CHECK_SYM expr
+ CHECK_SYM '(' expr ')'
;
opt_constraint:
| Thread |
|---|
| • bk commit into 6.0 tree (malff:1.2644) BUG#35578 | marc.alff | 13 May |