A fix (bug #6441: Aggregate UDF in multi-table query crashes MySQL when returning multiple rows).

This commit is contained in:
ram@gw.mysql.r18.ru 2004-11-06 09:37:30 +04:00
parent c3293b875b
commit 167c9489fa
3 changed files with 14 additions and 10 deletions

View File

@ -1601,6 +1601,8 @@ longlong Item_func_bit_count::val_int()
#ifdef HAVE_DLOPEN #ifdef HAVE_DLOPEN
udf_handler::~udf_handler() udf_handler::~udf_handler()
{
if (!not_original)
{ {
if (initialized) if (initialized)
{ {
@ -1615,6 +1617,7 @@ udf_handler::~udf_handler()
if (buffers) // Because of bug in ecc if (buffers) // Because of bug in ecc
delete [] buffers; delete [] buffers;
} }
}
bool bool

View File

@ -532,7 +532,7 @@ public:
:Item_sum( list ), udf(udf_arg) :Item_sum( list ), udf(udf_arg)
{ quick_group=0;} { quick_group=0;}
Item_udf_sum(THD *thd, Item_udf_sum *item) Item_udf_sum(THD *thd, Item_udf_sum *item)
:Item_sum(thd, item), udf(item->udf) {} :Item_sum(thd, item), udf(item->udf) { udf.not_original= TRUE; }
const char *func_name() const { return udf.name(); } const char *func_name() const { return udf.name(); }
bool fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) bool fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
{ {

View File

@ -56,8 +56,9 @@ class udf_handler :public Sql_alloc
public: public:
table_map used_tables_cache; table_map used_tables_cache;
bool const_item_cache; bool const_item_cache;
bool not_original;
udf_handler(udf_func *udf_arg) :u_d(udf_arg), buffers(0), error(0), udf_handler(udf_func *udf_arg) :u_d(udf_arg), buffers(0), error(0),
is_null(0), initialized(0) is_null(0), initialized(0), not_original(0)
{} {}
~udf_handler(); ~udf_handler();
const char *name() const { return u_d ? u_d->name.str : "?"; } const char *name() const { return u_d ? u_d->name.str : "?"; }