summaryrefslogtreecommitdiff
path: root/sql/item.cc
diff options
context:
space:
mode:
authorunknown <Sinisa@sinisa.nasamreza.org>2003-03-17 15:16:26 +0200
committerunknown <Sinisa@sinisa.nasamreza.org>2003-03-17 15:16:26 +0200
commit9e4848c229a36e5f738eab2b2f5e4fb23e572bb9 (patch)
treec21cba3ec77d95240a1d13a6fc48b9cdbea49d26 /sql/item.cc
parent6da897e04b3da790dfd0eed9d26dddf558e000dc (diff)
downloadmariadb-git-9e4848c229a36e5f738eab2b2f5e4fb23e572bb9.tar.gz
A fix for a bug reported by Per Erik Martin, partaining to
usage of expressions whose result are to be saved into user vars.
Diffstat (limited to 'sql/item.cc')
-rw-r--r--sql/item.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/sql/item.cc b/sql/item.cc
index 3c6b85e933b..becda6751bc 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -1192,7 +1192,16 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference)
}
}
- if (((*ref)->with_sum_func &&
+/*
+ * The following conditional is changed as to correctly identify
+ * incorrect references in group functions or forward references
+ * with sub-select's / derived tables, while it prevents this
+ * check when Item_ref is created in an expression involving
+ * summing function, which is to be placed in the user variable.
+ *
+ */
+
+ if (((*ref)->with_sum_func && name &&
(depended_from ||
!(thd->lex.current_select->linkage != GLOBAL_OPTIONS_TYPE &&
thd->lex.current_select->select_lex()->having_fix_field))) ||