summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <igor@rurik.mysql.com>2004-08-12 00:02:29 -0700
committerunknown <igor@rurik.mysql.com>2004-08-12 00:02:29 -0700
commit090bc713a4ebae95ac07a862800a69e723833b29 (patch)
treeec0b9895a13bfd75cd3675d8e53a52bb082390ea /sql
parentec5c569103aca010816834426b9f56752f33a1c1 (diff)
downloadmariadb-git-090bc713a4ebae95ac07a862800a69e723833b29.tar.gz
olap.test, olap.result:
Added test case for bug #4767. item_sum.cc: Added a correct setting of the maybe_null flag for a copy of an Item_sum object where the argument was a field of an inner table in an outer join read from a temporary table. It's part of the fix for bug #4767. sql_select.cc: Made change_refs_to_tmp_fields work correctly for test case of bug #4767 where Item_sum::get_tmp_table_item failed to build a correct copy of an Item_sum object referring to a field in a temporary table. It looks like a hack yet. sql/sql_select.cc: Made change_refs_to_tmp_fields work correctly for test case of bug #4767 where Item_sum::get_tmp_table_item failed to build a copy of an Item_sum object referring to a field in a temporary table. It looks like a hack yet. sql/item_sum.cc: Added a correct setting of maybe_null flag for copy of a Item_sum object where there argument is a field of nullable table read from the temporary table. It's part of the fix for bug #4767. mysql-test/r/olap.result: Added test case for bug #4767. mysql-test/t/olap.test: Added test case for bug #4767.
Diffstat (limited to 'sql')
-rw-r--r--sql/item_sum.cc3
-rw-r--r--sql/sql_select.cc2
2 files changed, 5 insertions, 0 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 7a8e15e0a9d..8411e7d1b9b 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -159,7 +159,10 @@ Item *Item_sum::get_tmp_table_item(THD *thd)
if (!arg->const_item())
{
if (arg->type() == Item::FIELD_ITEM)
+ {
+ arg->maybe_null= result_field_tmp->maybe_null();
((Item_field*) arg)->field= result_field_tmp++;
+ }
else
sum_item->args[i]= new Item_field(result_field_tmp++);
}
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index f8bc6210a2f..87b869df658 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -4995,6 +4995,8 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
blob_count++;
}
((Item_sum*) item)->args[i]= new Item_field(new_field);
+ if (((Item_sum*) item)->arg_count == 1)
+ ((Item_sum*) item)->result_field= new_field;
}
}
}