summaryrefslogtreecommitdiff
path: root/sql/sql_union.cc
diff options
context:
space:
mode:
authorunknown <Sinisa@sinisa.nasamreza.org>2003-08-06 18:48:34 +0300
committerunknown <Sinisa@sinisa.nasamreza.org>2003-08-06 18:48:34 +0300
commitb5e85696741e02ab33432bdec254edd802839fa1 (patch)
tree2175cccf3ca201dc44c8b403fe9e891dfde092b8 /sql/sql_union.cc
parent5dadac8701ae9cd464b052f03137117e71983072 (diff)
downloadmariadb-git-b5e85696741e02ab33432bdec254edd802839fa1.tar.gz
sql_union.cc, sql_select.cc:
Code clean-up sql_union.cc, union.test, union.result: A fix for a bug #978. This enables that NULL's can be entered into UNION's result set, although first SELECT columns are NOT NULL. This is also a start of fixing UNION's properly regarding type acceptance. sql_select.cc: A commit for my second July SPRINT task mysql-test/r/union.result: A fix for a bug #978. This enables that NULL's can be entered into UNION's result set, although first SELECT columns are NOT NULL. This is also a start of fixing UNION's properly regarding type acceptance. mysql-test/t/union.test: A fix for a bug #978. This enables that NULL's can be entered into UNION's result set, although first SELECT columns are NOT NULL. This is also a start of fixing UNION's properly regarding type acceptance. sql/sql_select.cc: Code clean-up sql/sql_union.cc: Code clean-up
Diffstat (limited to 'sql/sql_union.cc')
-rw-r--r--sql/sql_union.cc16
1 files changed, 6 insertions, 10 deletions
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index bd97a68e2d3..fae6810bab0 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -154,8 +154,6 @@ int st_select_lex_unit::prepare(THD *thd, select_result *sel_result,
goto err;
List_iterator<Item> it(select_cursor->item_list);
Item *item;
- while((item=it++))
- item->maybe_null=1;
item_list= select_cursor->item_list;
select_cursor->with_wild= 0;
if (setup_ref_array(thd, &select_cursor->ref_pointer_array,
@@ -166,6 +164,12 @@ int st_select_lex_unit::prepare(THD *thd, select_result *sel_result,
item_list, 0, 0, 1))
goto err;
t_and_f= 1;
+ while((item=it++))
+ {
+ item->maybe_null=1;
+ if (item->type() == Item::FIELD_ITEM)
+ ((class Item_field *)item)->field->table->maybe_null=1;
+ }
}
tmp_table_param.field_count=item_list.elements;
@@ -249,7 +253,6 @@ err:
int st_select_lex_unit::exec()
{
- int do_print_slow= 0;
SELECT_LEX_NODE *lex_select_save= thd->lex.current_select;
SELECT_LEX *select_cursor=first_select_in_union();
DBUG_ENTER("st_select_lex_unit::exec");
@@ -317,7 +320,6 @@ int st_select_lex_unit::exec()
thd->lex.current_select= lex_select_save;
DBUG_RETURN(res);
}
- do_print_slow|= select_cursor->options;
}
}
optimized= 1;
@@ -360,12 +362,6 @@ int st_select_lex_unit::exec()
Mark for slow query log if any of the union parts didn't use
indexes efficiently
*/
- select_cursor->options= ((select_cursor->options &
- ~(QUERY_NO_INDEX_USED |
- QUERY_NO_GOOD_INDEX_USED)) |
- do_print_slow &
- (QUERY_NO_INDEX_USED |
- QUERY_NO_GOOD_INDEX_USED));
}
}
thd->lex.current_select= lex_select_save;