mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
fixed bug 185 (constant IN (SELECT field ...) do not return NULL correctly)
mysql-test/r/subselect.result: new test results test of bug 185 mysql-test/t/subselect.test: test of bug 185 sql/item.h: new method sql/item_cmpfunc.cc: new Item to control NULL value in HAVING clouse sql/item_cmpfunc.h: new Item to control NULL value in HAVING clouse sql/item_subselect.cc: if IN was rewrited through WHERE thien it will be rewrited in following way: WHERE left_expr=item or is null(item) heving is_not_null_test(item) sql/item_subselect.h: Item_is_not_null_test can change was_null flag sql/sql_select.cc: some layout fix
This commit is contained in:
@ -299,7 +299,7 @@ JOIN::prepare(Item ***rref_pointer_array,
|
||||
DBUG_RETURN(-1); /* purecov: inspected */
|
||||
|
||||
ref_pointer_array= *rref_pointer_array;
|
||||
|
||||
|
||||
if (having)
|
||||
{
|
||||
thd->where="having clause";
|
||||
@ -313,6 +313,7 @@ JOIN::prepare(Item ***rref_pointer_array,
|
||||
if (having->with_sum_func)
|
||||
having->split_sum_func(ref_pointer_array, all_fields);
|
||||
}
|
||||
|
||||
if (setup_ftfuncs(select_lex)) /* should be after having->fix_fields */
|
||||
DBUG_RETURN(-1);
|
||||
/*
|
||||
@ -426,7 +427,7 @@ JOIN::optimize()
|
||||
|
||||
#ifdef HAVE_REF_TO_FIELDS // Not done yet
|
||||
/* Add HAVING to WHERE if possible */
|
||||
if (having && !group_list && ! sum_func_count)
|
||||
if (having && !group_list && !sum_func_count)
|
||||
{
|
||||
if (!conds)
|
||||
{
|
||||
|
Reference in New Issue
Block a user