summaryrefslogtreecommitdiff
path: root/sql/item_subselect.cc
diff options
context:
space:
mode:
authorigor@olga.mysql.com <>2007-01-25 18:44:35 -0800
committerigor@olga.mysql.com <>2007-01-25 18:44:35 -0800
commit36df33d80abb4ed946c7feee6b20205619ba3534 (patch)
tree8a121243129b7782eb39a40dd3442eb15198b028 /sql/item_subselect.cc
parent9659c11b6eee9e3ddf7d18b40d9afbc00e310bf2 (diff)
downloadmariadb-git-36df33d80abb4ed946c7feee6b20205619ba3534.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.
Diffstat (limited to 'sql/item_subselect.cc')
-rw-r--r--sql/item_subselect.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 20a092d7607..cdbcde8b56b 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -39,6 +39,7 @@ Item_subselect::Item_subselect():
engine(0), old_engine(0), used_tables_cache(0), have_to_be_excluded(0),
const_item_cache(1), engine_changed(0), changed(0)
{
+ with_subselect= 1;
reset();
/*
item value is NULL if select_subselect not changed this value
@@ -201,6 +202,9 @@ bool Item_subselect::exec()
mem root
*/
thd->mem_root= &thd->main_mem_root;
+ if (thd->net.report_error)
+ /* Do not execute subselect in case of a fatal error */
+ return 1;
res= engine->exec();
thd->mem_root= old_root;