summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2003-02-15 00:11:00 +0200
committerunknown <bell@sanja.is.com.ua>2003-02-15 00:11:00 +0200
commitcef26176ad3c6224db5b25eb64cd0b301323d288 (patch)
treed7c517ef1c79abea07b74f64c5c49e4b193ab558 /sql
parentab2eeffb2443d3c2635c9d26eee73adb148384ad (diff)
downloadmariadb-git-cef26176ad3c6224db5b25eb64cd0b301323d288.tar.gz
fix of illegal usage aggregate functions
mysql-test/r/subselect.result: test of illegal aggregate functions mysql-test/t/subselect.test: test of illegal aggregate functions
Diffstat (limited to 'sql')
-rw-r--r--sql/item_subselect.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index fb51b5561e9..30643ec8385 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -88,7 +88,14 @@ bool Item_subselect::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
if (have_to_be_excluded)
engine->exclude();
substitution= 0;
- return (*ref)->fix_fields(thd, tables, ref);
+ int ret= (*ref)->fix_fields(thd, tables, ref);
+ // We can't substitute aggregate functions (like (SELECT (max(i)))
+ if ((*ref)->with_sum_func)
+ {
+ my_error(ER_INVALID_GROUP_FUNC_USE, MYF(0));
+ return 1;
+ }
+ return ret;
}
char const *save_where= thd->where;