summaryrefslogtreecommitdiff
path: root/sql/sql_yacc.yy
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2002-07-24 19:55:08 +0300
committerunknown <monty@mashka.mysql.fi>2002-07-24 19:55:08 +0300
commit72dec69046e315080d17e4764f911c4c9f29459c (patch)
tree31ee919bea7e4456572b62d5ea7302dc58bc0b6a /sql/sql_yacc.yy
parentc911e9d72161045364893a838624c1484590a9cb (diff)
downloadmariadb-git-72dec69046e315080d17e4764f911c4c9f29459c.tar.gz
Removed wrong implementation of CUBE/ROLLUP
Fixed bugfix of INSERT ... SET db_name.table_name.column_name Changed locking to external-locking Fix client hangup for some invalid SQL queries. Docs/manual.texi: Changelog & recent incompatible changes to 4.0.3 include/mysqld_error.h: New error messages myisam/ft_boolean_search.c: Removed compiler warning myisam/mi_check.c: Change mi_fix_rec_buff_for_blob to mi_alloc_rec_buff myisam/mi_dynrec.c: Change mi_fix_rec_buff_for_blob to mi_alloc_rec_buff myisam/mi_extra.c: Change mi_fix_rec_buff_for_blob to mi_alloc_rec_buff myisam/mi_key.c: Change mi_fix_rec_buff_for_blob to mi_alloc_rec_buff myisam/mi_open.c: Change mi_fix_rec_buff_for_blob to mi_alloc_rec_buff myisam/mi_packrec.c: Change mi_fix_rec_buff_for_blob to mi_alloc_rec_buff myisam/myisamdef.h: Change mi_fix_rec_buff_for_blob to mi_alloc_rec_buff myisam/sort.c: Fixed uninitialized variable mysql-test/r/insert_set.result: Change test case to use database foo mysql-test/r/union.result: Test wrong usage of union mysql-test/t/insert_set.test: Test bug in insert mysql-test/t/union.test: Test wrong usage of union sql/item.h: Indentation cleanup sql/item_cmpfunc.h: Indentation cleanup sql/item_func.h: Indentation cleanup sql/item_strfunc.h: Indentation cleanup sql/item_sum.h: Indentation cleanup sql/item_timefunc.h: Indentation cleanup sql/item_uniq.h: Indentation cleanup sql/mysql_priv.h: Fix that we always generate an error message when calling YYABORT sql/mysqld.cc: Changed command line arguments regarding locking to always use --external-locking Disable external locking by default sql/procedure.h: Cleanup sql/set_var.cc: change locking -> external_locking sql/share/czech/errmsg.txt: New error messages sql/share/danish/errmsg.txt: New error messages sql/share/dutch/errmsg.txt: New error messages sql/share/english/errmsg.txt: New error messages sql/share/estonian/errmsg.txt: New error messages sql/share/french/errmsg.txt: New error messages sql/share/german/errmsg.txt: New error messages sql/share/greek/errmsg.txt: New error messages sql/share/hungarian/errmsg.txt: New error messages sql/share/italian/errmsg.txt: New error messages sql/share/japanese/errmsg.txt: New error messages sql/share/korean/errmsg.txt: New error messages mysql-test/r/olap.result: Removed CUBE/ROLLUP mysql-test/t/olap.test: Removed CUBE/ROLLUP sql/share/norwegian-ny/errmsg.txt: New error messages sql/share/norwegian/errmsg.txt: New error messages sql/share/polish/errmsg.txt: New error messages sql/share/portuguese/errmsg.txt: New error messages sql/share/romanian/errmsg.txt: New error messages sql/share/russian/errmsg.txt: New error messages sql/share/slovak/errmsg.txt: New error messages sql/share/spanish/errmsg.txt: New error messages sql/share/swedish/errmsg.txt: New error messages sql/share/ukrainian/errmsg.txt: New error messages sql/sql_base.cc: Removed wrong patch for INSERT... sql/sql_insert.cc: Fix bug in INSERT ... SET db_name.table_name.column_name sql/sql_lex.h: Changed NON_EXISTIONG_ONE -> UNSPECIFIED_OLAP_TYPE sql/sql_olap.cc: Removed wrong implementation of CUBE/ROLLUP sql/sql_parse.cc: Removed wrong implementation of CUBE/ROLLUP Added function to give better error messages sql/sql_select.cc: Removed wrong implementation of CUBE/ROLLUP sql/sql_union.cc: Added comment sql/sql_yacc.yy: Fix that we always generate an error message when calling YYABORT
Diffstat (limited to 'sql/sql_yacc.yy')
-rw-r--r--sql/sql_yacc.yy180
1 files changed, 127 insertions, 53 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 767a2f67afb..1288f03155e 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -1435,22 +1435,51 @@ select_option_list:
select_option:
STRAIGHT_JOIN { Select->options|= SELECT_STRAIGHT_JOIN; }
- | HIGH_PRIORITY { if (Select != &Lex->select_lex) YYABORT; Lex->lock_option= TL_READ_HIGH_PRIORITY; }
+ | HIGH_PRIORITY
+ {
+ if (check_simple_select())
+ YYABORT;
+ Lex->lock_option= TL_READ_HIGH_PRIORITY;
+ }
| DISTINCT { Select->options|= SELECT_DISTINCT; }
| SQL_SMALL_RESULT { Select->options|= SELECT_SMALL_RESULT; }
| SQL_BIG_RESULT { Select->options|= SELECT_BIG_RESULT; }
- | SQL_BUFFER_RESULT { if (Select != &Lex->select_lex) YYABORT; Select->options|= OPTION_BUFFER_RESULT; }
- | SQL_CALC_FOUND_ROWS { if (Select != &Lex->select_lex) YYABORT; Select->options|= OPTION_FOUND_ROWS; }
- | SQL_NO_CACHE_SYM { if (Select != &Lex->select_lex) YYABORT; current_thd->safe_to_cache_query=0; }
- | SQL_CACHE_SYM { if (Select != &Lex->select_lex) YYABORT; Select->options |= OPTION_TO_QUERY_CACHE; }
- | ALL {};
+ | SQL_BUFFER_RESULT
+ {
+ if (check_simple_select())
+ YYABORT;
+ Select->options|= OPTION_BUFFER_RESULT;
+ }
+ | SQL_CALC_FOUND_ROWS
+ {
+ if (check_simple_select())
+ YYABORT;
+ Select->options|= OPTION_FOUND_ROWS;
+ }
+ | SQL_NO_CACHE_SYM { current_thd->safe_to_cache_query=0; }
+ | SQL_CACHE_SYM { Select->options|= OPTION_TO_QUERY_CACHE; }
+ | ALL {}
+ ;
select_lock_type:
/* empty */
| FOR_SYM UPDATE_SYM
- { if (Select != &Lex->select_lex) YYABORT; Lex->lock_option= TL_WRITE; current_thd->safe_to_cache_query=0; }
+ {
+ LEX *lex=Lex;
+ if (check_simple_select())
+ YYABORT;
+ lex->lock_option= TL_WRITE;
+ lex->thd->safe_to_cache_query=0;
+ }
| LOCK_SYM IN_SYM SHARE_SYM MODE_SYM
- { if (Select != &Lex->select_lex) YYABORT; Lex->lock_option= TL_READ_WITH_SHARED_LOCKS; current_thd->safe_to_cache_query=0; };
+ {
+ LEX *lex=Lex;
+ if (check_simple_select())
+ YYABORT;
+ lex->lock_option= TL_READ_WITH_SHARED_LOCKS;
+ lex->thd->safe_to_cache_query=0;
+ }
+ ;
select_item_list:
select_item_list ',' select_item
@@ -2047,7 +2076,8 @@ join_table:
{
SELECT_LEX *sel=Select;
if (!($$=add_table_to_list($2,$3,0,TL_UNLOCK, sel->use_index_ptr,
- sel->ignore_index_ptr))) YYABORT;
+ sel->ignore_index_ptr)))
+ YYABORT;
}
| '{' ident join_table LEFT OUTER JOIN_SYM join_table ON expr '}'
{ add_join_on($7,$9); $7->outer_join|=JOIN_TYPE_LEFT; $$=$7; };
@@ -2158,14 +2188,21 @@ olap_opt:
/* empty */ {}
| WITH CUBE_SYM
{
- Lex->olap = true;
- Select->olap= CUBE_TYPE;
+ LEX *lex=Lex;
+ lex->olap = true;
+ lex->select->olap= CUBE_TYPE;
+ net_printf(&lex->thd->net, ER_NOT_SUPPORTED_YET, "CUBE");
+ YYABORT; /* To be deleted in 4.1 */
}
| WITH ROLLUP_SYM
{
- Lex->olap = true;
- Select->olap= ROLLUP_TYPE;
+ LEX *lex=Lex;
+ lex->olap = true;
+ lex->select->olap= ROLLUP_TYPE;
+ net_printf(&lex->thd->net, ER_NOT_SUPPORTED_YET, "ROLLUP");
+ YYABORT; /* To be deleted in 4.1 */
}
+ ;
/*
Order by statement in select
@@ -2180,9 +2217,17 @@ order_clause:
{
LEX *lex=Lex;
if (lex->sql_command == SQLCOM_MULTI_UPDATE)
+ {
+ net_printf(&lex->thd->net, ER_WRONG_USAGE, "UPDATE", "ORDER BY");
YYABORT;
- if (lex->olap)
- YYABORT;
+ }
+ if (lex->select->olap != UNSPECIFIED_OLAP_TYPE)
+ {
+ net_printf(&lex->thd->net, ER_WRONG_USAGE,
+ "CUBE/ROLLUP",
+ "ORDER BY");
+ YYABORT;
+ }
lex->select->sort_default=1;
} order_list;
@@ -2203,8 +2248,12 @@ limit_clause:
| LIMIT ULONG_NUM
{
LEX *lex=Lex;
- if (lex->olap)
+ if (lex->select->olap != UNSPECIFIED_OLAP_TYPE)
+ {
+ net_printf(&lex->thd->net, ER_WRONG_USAGE, "CUBE/ROLLUP",
+ "LIMIT");
YYABORT;
+ }
SELECT_LEX *sel=Select;
sel->select_limit= $2;
sel->offset_limit= 0L;
@@ -2212,9 +2261,13 @@ limit_clause:
| LIMIT ULONG_NUM ',' ULONG_NUM
{
LEX *lex=Lex;
- if (lex->olap)
+ if (lex->select->olap != UNSPECIFIED_OLAP_TYPE)
+ {
+ net_printf(&lex->thd->net, ER_WRONG_USAGE, "CUBE/ROLLUP",
+ "LIMIT");
YYABORT;
- SELECT_LEX *sel=Select;
+ }
+ SELECT_LEX *sel=lex->select;
sel->select_limit= $4;
sel->offset_limit= $2;
};
@@ -2224,7 +2277,10 @@ delete_limit_clause:
{
LEX *lex=Lex;
if (lex->sql_command == SQLCOM_MULTI_UPDATE)
+ {
+ net_printf(&lex->thd->net, ER_WRONG_USAGE, "DELETE", "LIMIT");
YYABORT;
+ }
lex->select->select_limit= HA_POS_ERROR;
}
| LIMIT ulonglong_num
@@ -3475,8 +3531,8 @@ opt_table:
lex->grant = DB_ACLS & ~GRANT_ACL;
else if (lex->columns.elements)
{
- send_error(&lex->thd->net,ER_ILLEGAL_GRANT_FOR_TABLE);
- YYABORT;
+ send_error(&lex->thd->net,ER_ILLEGAL_GRANT_FOR_TABLE);
+ YYABORT;
}
}
| ident '.' '*'
@@ -3514,8 +3570,13 @@ opt_table:
user_list:
- grant_user { if (Lex->users_list.push_back($1)) YYABORT;}
- | user_list ',' grant_user { if (Lex->users_list.push_back($3)) YYABORT;};
+ grant_user { if (Lex->users_list.push_back($1)) YYABORT;}
+ | user_list ',' grant_user
+ {
+ if (Lex->users_list.push_back($3))
+ YYABORT;
+ }
+ ;
grant_user:
@@ -3631,42 +3692,55 @@ rollback:
union:
- /* empty */ {}
- | union_list;
+ /* empty */ {}
+ | union_list;
union_list:
- UNION_SYM union_option
- {
- LEX *lex=Lex;
- if (lex->exchange)
- {
- /* Only the last SELECT can have INTO...... */
- net_printf(&lex->thd->net, ER_WRONG_USAGE,"UNION","INTO");
- YYABORT;
- }
- if (lex->select->linkage == NOT_A_SELECT || mysql_new_select(lex))
- YYABORT;
- lex->select->linkage=UNION_TYPE;
- }
- select_init;
+ UNION_SYM union_option
+ {
+ LEX *lex=Lex;
+ if (lex->exchange)
+ {
+ /* Only the last SELECT can have INTO...... */
+ net_printf(&lex->thd->net, ER_WRONG_USAGE,"UNION","INTO");
+ YYABORT;
+ }
+ if (lex->select->linkage == NOT_A_SELECT)
+ {
+ send_error(&lex->thd->net, ER_SYNTAX_ERROR);
+ YYABORT;
+ }
+ if (mysql_new_select(lex))
+ YYABORT;
+ lex->select->linkage=UNION_TYPE;
+ }
+ select_init
+ ;
union_opt:
- union {}
- | optional_order_or_limit {};
+ union {}
+ | optional_order_or_limit {};
optional_order_or_limit:
- /* empty */ {}
- |
- {
- LEX *lex=Lex;
- if (!lex->select->braces || mysql_new_select(lex))
- YYABORT;
- mysql_init_select(lex);
- lex->select->linkage=NOT_A_SELECT;
- lex->select->select_limit=lex->thd->variables.select_limit;
- }
- opt_order_clause limit_clause;
+ /* empty */ {}
+ |
+ {
+ LEX *lex=Lex;
+ if (!lex->select->braces)
+ {
+ send_error(&lex->thd->net, ER_SYNTAX_ERROR);
+ YYABORT;
+ }
+ if (mysql_new_select(lex))
+ YYABORT;
+ mysql_init_select(lex);
+ lex->select->linkage=NOT_A_SELECT;
+ lex->select->select_limit=lex->thd->variables.select_limit;
+ }
+ opt_order_clause limit_clause
+ ;
union_option:
- /* empty */ {}
- | ALL {Lex->union_option=1;};
+ /* empty */ {}
+ | ALL { Lex->union_option=1; }
+ ;