Below is the list of changes that have just been committed into a local
5.0 repository of antony. When antony 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, 2006-10-25 02:52:42-07:00, acurtis@stripped +4 -0
Bug#9801
"WITH CHECK OPTION doesn't parse with GROUP BY"
Implement L(2) lookahead to disambiguate WITH token
mysql-test/r/view.result@stripped, 2006-10-25 02:52:38-07:00, acurtis@stripped +7 -0
Test for bug
mysql-test/t/view.test@stripped, 2006-10-25 02:52:38-07:00, acurtis@stripped +9 -0
Test for bug
sql/sql_lex.cc@stripped, 2006-10-25 02:52:38-07:00, acurtis@stripped +32 -0
implement one token lookahead to disambiguate WITH
sql/sql_yacc.yy@stripped, 2006-10-25 02:52:38-07:00, acurtis@stripped +12 -6
new L(2) tokens
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: acurtis
# Host: ltamd64.xiphis.org
# Root: /home/antony/work2/p3-bug9801.1
--- 1.202/sql/sql_lex.cc 2006-10-25 02:52:51 -07:00
+++ 1.203/sql/sql_lex.cc 2006-10-25 02:52:51 -07:00
@@ -639,6 +639,38 @@
yyUnget();
if ((tokval = find_keyword(lex,length,c == '(')))
{
+ if (tokval == WITH)
+ {
+ lex->next_state= MY_LEX_START;
+ /* we should have a smaller substructure in LEX for lexer state */
+ uchar *svtok_end_prev= lex->tok_end_prev;
+ uchar *svtok_start_prev= lex->tok_start_prev;
+ uchar *svtok_end= lex->tok_end;
+ uchar *svtok_start= lex->tok_start;
+ uchar *svptr= lex->ptr;
+ int lookahead= MYSQLlex(arg, yythd);
+ switch (lookahead) {
+ case CUBE_SYM:
+ return WITH_CUBE_SYM;
+ case ROLLUP_SYM:
+ return WITH_ROLLUP_SYM;
+ case CHECK_SYM:
+ return WITH_CHECK_SYM;
+ case CASCADED:
+ return WITH_CASCADED_SYM;
+ case LOCAL_SYM:
+ return WITH_LOCAL_SYM;
+ case QUERY_SYM:
+ return WITH_QUERY_SYM;
+ default:
+ lex->tok_end_prev= svtok_end_prev;
+ lex->tok_start_prev= svtok_start_prev;
+ lex->tok_end= svtok_end;
+ lex->tok_start= svtok_start;
+ lex->ptr= svptr;
+ break;
+ }
+ }
lex->next_state= MY_LEX_START; // Allow signed numbers
return(tokval); // Was keyword
}
--- 1.491/sql/sql_yacc.yy 2006-10-25 02:52:51 -07:00
+++ 1.492/sql/sql_yacc.yy 2006-10-25 02:52:51 -07:00
@@ -680,6 +680,12 @@
%token WHERE
%token WHILE_SYM
%token WITH
+%token WITH_CASCADED_SYM
+%token WITH_CHECK_SYM
+%token WITH_CUBE_SYM
+%token WITH_LOCAL_SYM
+%token WITH_ROLLUP_SYM
+%token WITH_QUERY_SYM
%token WORK_SYM
%token WRITE_SYM
%token X509_SYM
@@ -4959,7 +4965,7 @@
fulltext_options:
/* nothing */ { $$= FT_NL; }
- | WITH QUERY_SYM EXPANSION_SYM { $$= FT_NL | FT_EXPAND; }
+ | WITH_QUERY_SYM EXPANSION_SYM { $$= FT_NL | FT_EXPAND; }
| IN_SYM BOOLEAN_SYM MODE_SYM { $$= FT_BOOL; }
;
@@ -5686,7 +5692,7 @@
olap_opt:
/* empty */ {}
- | WITH CUBE_SYM
+ | WITH_CUBE_SYM
{
LEX *lex=Lex;
if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE)
@@ -5699,7 +5705,7 @@
my_error(ER_NOT_SUPPORTED_YET, MYF(0), "CUBE");
YYABORT; /* To be deleted in 5.1 */
}
- | WITH ROLLUP_SYM
+ | WITH_ROLLUP_SYM
{
LEX *lex= Lex;
if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE)
@@ -9130,11 +9136,11 @@
view_check_option:
/* empty */
{ Lex->create_view_check= VIEW_CHECK_NONE; }
- | WITH CHECK_SYM OPTION
+ | WITH_CHECK_SYM OPTION
{ Lex->create_view_check= VIEW_CHECK_CASCADED; }
- | WITH CASCADED CHECK_SYM OPTION
+ | WITH_CASCADED_SYM CHECK_SYM OPTION
{ Lex->create_view_check= VIEW_CHECK_CASCADED; }
- | WITH LOCAL_SYM CHECK_SYM OPTION
+ | WITH_LOCAL_SYM CHECK_SYM OPTION
{ Lex->create_view_check= VIEW_CHECK_LOCAL; }
;
--- 1.180/mysql-test/r/view.result 2006-10-25 02:52:51 -07:00
+++ 1.181/mysql-test/r/view.result 2006-10-25 02:52:51 -07:00
@@ -2966,4 +2966,11 @@
ERROR HY000: CHECK OPTION failed 'test.v1'
DROP VIEW v1;
DROP TABLE t1;
+CREATE TABLE t1 (s1 INT);
+CREATE VIEW v1 AS SELECT SUM(s1) FROM t1 GROUP BY s1 WITH CHECK OPTION;
+ERROR HY000: CHECK OPTION on non-updatable view 'test.v1'
+DROP VIEW IF EXISTS v1;
+Warnings:
+Note 1051 Unknown table 'test.v1'
+DROP TABLE t1;
End of 5.0 tests.
--- 1.167/mysql-test/t/view.test 2006-10-25 02:52:51 -07:00
+++ 1.168/mysql-test/t/view.test 2006-10-25 02:52:51 -07:00
@@ -2894,4 +2894,13 @@
DROP VIEW v1;
DROP TABLE t1;
+#
+# Bug #9801: WITH CHECK OPTION doesn't parse with GROUP BY
+#
+CREATE TABLE t1 (s1 INT);
+--error ER_VIEW_NONUPD_CHECK
+CREATE VIEW v1 AS SELECT SUM(s1) FROM t1 GROUP BY s1 WITH CHECK OPTION;
+DROP VIEW IF EXISTS v1;
+DROP TABLE t1;
+
--echo End of 5.0 tests.
| Thread |
|---|
| • bk commit into 5.0 tree (acurtis:1.2291) BUG#9801 | antony | 25 Oct |