• Tatiana A. Nurnberg's avatar
    Bug#48295: explain extended crash with subquery and ONLY_FULL_GROUP_BY sql_mode · eaad6119
    Tatiana A. Nurnberg authored
    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).
    
    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.
    eaad6119
explain.test 5.28 KB