summaryrefslogtreecommitdiff
path: root/sql/item_subselect.cc
diff options
context:
space:
mode:
authorTatiana A. Nurnberg <azundris@mysql.com>2010-03-02 18:00:53 +0000
committerTatiana A. Nurnberg <azundris@mysql.com>2010-03-02 18:00:53 +0000
commitc610e9783aa4474d2b4418f1b3b3685716a83454 (patch)
tree1a4e16af1d32226340e6cf694dcbb7499fbc4b9e /sql/item_subselect.cc
parent44c1a79b0e6af3f87712af7e7386aa6c516b89f9 (diff)
downloadmariadb-git-c610e9783aa4474d2b4418f1b3b3685716a83454.tar.gz
Bug#48295: explain extended crash with subquery and ONLY_FULL_GROUP_BY sql
If an outer query is broken, a subquery might not even get set up. EXPLAIN EXTENDED did not expect this and merrily tried to de-ref all of the half-setup info. We now catch this case and print as much as we have, as it doesn't cost us anything (doesn't make regular execution slower). backport from 5.1 mysql-test/r/explain.result: Show that EXPLAIN EXTENDED with subquery and illegal out query doesn't crash. Show also that SHOW WARNINGS will render an additional Note in the hope of being, well, helpful. mysql-test/t/explain.test: If we have only half a query for EXPLAIN EXTENDED to print (i.e., incomplete subquery info as outer query is illegal), we should provide the user with as much info as we easily can if they ask for it. What we should not do is crash when they come asking for help, that violates etiquette in some countries. sql/item_subselect.cc: If the sub-query's actually set up, print it. Otherwise, elide.
Diffstat (limited to 'sql/item_subselect.cc')
-rw-r--r--sql/item_subselect.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 80fbc2c74d3..1822a7ced56 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -262,9 +262,14 @@ void Item_subselect::update_used_tables()
void Item_subselect::print(String *str)
{
- str->append('(');
- engine->print(str);
- str->append(')');
+ if (engine)
+ {
+ str->append('(');
+ engine->print(str);
+ str->append(')');
+ }
+ else
+ str->append("(...)");
}