summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <gkodinov@dl145s.mysql.com>2006-10-19 14:34:56 +0200
committerunknown <gkodinov@dl145s.mysql.com>2006-10-19 14:34:56 +0200
commit9bfaab57fa991d46844b5e56cb30880c8391c55d (patch)
tree43b7542f43155a03a7fe33aeb33037a157241c80 /sql
parentae4965971137a9a9c12c642e9afe5a5f72245e14 (diff)
parent53924bdc77526b199aa8d327b96ca8e8a1e41982 (diff)
downloadmariadb-git-9bfaab57fa991d46844b5e56cb30880c8391c55d.tar.gz
Merge dl145s.mysql.com:/data/bk/team_tree_merge/mysql-4.1
into dl145s.mysql.com:/data/bk/team_tree_merge/MERGE/mysql-4.1-opt sql/sql_select.cc: Auto merged
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_base.cc11
-rw-r--r--sql/sql_select.cc7
2 files changed, 15 insertions, 3 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 0a9529d6067..40adf5e1f15 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -2284,12 +2284,19 @@ find_item_in_list(Item *find, List<Item> &items, uint *counter,
const char *field_name=0;
const char *table_name=0;
bool found_unaliased_non_uniq= 0;
+ /*
+ true if the item that we search for is a valid name reference
+ (and not an item that happens to have a name).
+ */
+ bool is_ref_by_name= 0;
uint unaliased_counter;
LINT_INIT(unaliased_counter);
*unaliased= FALSE;
- if (find->type() == Item::FIELD_ITEM || find->type() == Item::REF_ITEM)
+ is_ref_by_name= (find->type() == Item::FIELD_ITEM ||
+ find->type() == Item::REF_ITEM);
+ if (is_ref_by_name)
{
field_name= ((Item_ident*) find)->field_name;
table_name= ((Item_ident*) find)->table_name;
@@ -2401,7 +2408,7 @@ find_item_in_list(Item *find, List<Item> &items, uint *counter,
}
}
else if (!table_name && (item->eq(find,0) ||
- find->name && item->name &&
+ is_ref_by_name && find->name && item->name &&
!my_strcasecmp(system_charset_info,
item->name,find->name)))
{
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 33e923e1553..e63916ebb49 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -9711,12 +9711,17 @@ bool JOIN::rollup_init()
while ((item= it++))
{
ORDER *group_tmp;
+ bool found_in_group= 0;
+
for (group_tmp= group_list; group_tmp; group_tmp= group_tmp->next)
{
if (*group_tmp->item == item)
+ {
item->maybe_null= 1;
+ found_in_group= 1;
+ }
}
- if (item->type() == Item::FUNC_ITEM)
+ if (item->type() == Item::FUNC_ITEM && !found_in_group)
{
bool changed= FALSE;
if (change_group_ref(thd, (Item_func *) item, group_list, &changed))