• unknown's avatar
    Fixed bug #24653. · da561a80
    unknown authored
    The bug report has demonstrated the following two problems.
    1. If an ORDER/GROUP BY list includes a constant expression being 
    optimized away and, at the same time, containing single-row
    subselects that return more that one row, no error is reported.
    Strictly speaking the standard allows to ignore error in this case.
    Yet, now a corresponding fatal error is reported in this case.
    2. If a query requires sorting by expressions containing single-row
    subselects that, however, return more than one row, then the execution
    of the query may cause a server crash. 
    To fix this some code has been added that blocks execution of a subselect
    item in case of a fatal error in the method Item_subselect::exec.
    
    
    mysql-test/r/subselect.result:
      Added a test cases for bug #24653.
    mysql-test/t/subselect.test:
      Added a test cases for bug #24653.
    sql/filesort.cc:
      Fixed bug #24653.
      Added a check for fatal error after reading the next row from the table
      in the function find_all_keys.
    sql/item.cc:
      Fixed bug #24653.
      Down-ported calculation of the attribute with_subselect of for Item objects.
    sql/item.h:
      Fixed bug #24653.
      Down-ported calculation of the attribute with_subselect of for Item objects.
    sql/item_cmpfunc.cc:
      Fixed bug #24653.
      Down-ported calculation of the attribute with_subselect of for Item objects.
    sql/item_cmpfunc.h:
      Fixed bug #24653.
      Down-ported calculation of the attribute with_subselect of for Item objects.
    sql/item_func.cc:
      Fixed bug #24653.
      Down-ported calculation of the attribute with_subselect of for Item objects.
    sql/item_subselect.cc:
      Fixed bug #24653.
      Added a check for fatal error in the method Item_subselect::exec
      to block evaluation of subselects in erroneous situations.
      Down-ported calculation of the attribute with_subselect of for Item objects.
    sql/sql_select.cc:
      Fixed bug #24653.
      Added a check to verify that any constant expression used
      in ORDER BY and/or GROUP BY lists which is optimized away
      does not contain subselects returning more than one row.
      If it does a fatal error is reported.
    da561a80
item_cmpfunc.cc 70.3 KB