diff options
author | unknown <igor@olga.mysql.com> | 2007-01-25 18:44:35 -0800 |
---|---|---|
committer | unknown <igor@olga.mysql.com> | 2007-01-25 18:44:35 -0800 |
commit | da561a802caff95d755b8d2061c27c248f22e3cd (patch) | |
tree | 8a121243129b7782eb39a40dd3442eb15198b028 /sql/item_cmpfunc.h | |
parent | 6d04643ab3b8ed31a693ac1df6dadc7da42c53b8 (diff) | |
download | mariadb-git-da561a802caff95d755b8d2061c27c248f22e3cd.tar.gz |
Fixed bug #24653.
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.
Diffstat (limited to 'sql/item_cmpfunc.h')
-rw-r--r-- | sql/item_cmpfunc.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 0e157fd412c..4635a301c31 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -843,7 +843,8 @@ public: else { args[0]->update_used_tables(); - if ((const_item_cache= !(used_tables_cache= args[0]->used_tables()))) + if ((const_item_cache= !(used_tables_cache= args[0]->used_tables())) && + !with_subselect) { /* Remember if the value is always NULL or never NULL */ cached_value= (longlong) args[0]->is_null(); |