summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorkroki@mysql.com <>2006-05-03 18:02:43 +0400
committerkroki@mysql.com <>2006-05-03 18:02:43 +0400
commit96f0aa3cfbb58810516e7f07505153f303bbcad8 (patch)
treec58eeded40e2e6c11428797b1ac18a15eb1c9ee9 /sql
parentc40f8557dce50aabccc2f1fc228c7a3ebdceb55f (diff)
downloadmariadb-git-96f0aa3cfbb58810516e7f07505153f303bbcad8.tar.gz
Bug#15463: EXPLAIN SELECT..INTO hangs the client (QB, command line)
There were two distict bugs: parse error was returned for valid statement and that error wasn't reported to the client. The fix ensures that EXPLAIN SELECT..INTO is accepted by parser and any other parse error will be reported to the client.
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_parse.cc1
-rw-r--r--sql/sql_yacc.yy20
2 files changed, 16 insertions, 5 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 196e723299a..649714315a6 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -5709,6 +5709,7 @@ void mysql_parse(THD *thd, char *inBuf, uint length)
}
else
{
+ DBUG_ASSERT(thd->net.report_error);
DBUG_PRINT("info",("Command aborted. Fatal_error: %d",
thd->is_fatal_error));
query_cache_abort(&thd->net);
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 6473163a6ec..261d10f3e79 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -5795,7 +5795,11 @@ select_var_ident:
if (lex->result)
((select_dumpvar *)lex->result)->var_list.push_back( new my_var($2,0,0,(enum_field_types)0));
else
- YYABORT;
+ /*
+ The parser won't create select_result instance only
+ if it's an EXPLAIN.
+ */
+ DBUG_ASSERT(lex->describe);
}
| ident_or_text
{
@@ -5807,10 +5811,8 @@ select_var_ident:
my_error(ER_SP_UNDECLARED_VAR, MYF(0), $1.str);
YYABORT;
}
- if (! lex->result)
- YYABORT;
- else
- {
+ if (lex->result)
+ {
my_var *var;
((select_dumpvar *)lex->result)->
var_list.push_back(var= new my_var($1,1,t->offset,t->type));
@@ -5818,6 +5820,14 @@ select_var_ident:
if (var)
var->sp= lex->sphead;
#endif
+ }
+ else
+ {
+ /*
+ The parser won't create select_result instance only
+ if it's an EXPLAIN.
+ */
+ DBUG_ASSERT(lex->describe);
}
}
;