From bf8dac3b1949b16b4a91f0f09ec81806e73a46d7 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 3 May 2006 18:02:43 +0400 Subject: 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. mysql-test/r/explain.result: Add result for bug#15463. mysql-test/t/explain.test: Add test case for bug#15463. sql/sql_parse.cc: Assert that if parsing error has occured then apropriate error message has been pushed into error stack. sql/sql_yacc.yy: If there is no lex->result in select_var_ident rule, then we have to be in DESCRIBE mode. --- sql/sql_parse.cc | 1 + sql/sql_yacc.yy | 20 +++++++++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) (limited to 'sql') 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); } } ; -- cgit v1.2.1