summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <Sinisa@sinisa.nasamreza.org>2002-10-16 22:27:47 +0300
committerunknown <Sinisa@sinisa.nasamreza.org>2002-10-16 22:27:47 +0300
commitd482a3afd0891d30d1623c9e0664cfc85c3855ee (patch)
treefc2416590dbbeb05b27ffaf9e8c56d0df14016ae
parent14cc2fc140dd1bc96d00c93aeb558a7dfc937889 (diff)
downloadmariadb-git-d482a3afd0891d30d1623c9e0664cfc85c3855ee.tar.gz
fix of the small bug in UNION's
mysql-test/r/heap_btree.result: I donno why this changed, aint my fault sql/sql_union.cc: fix of the small bug
-rw-r--r--mysql-test/r/heap_btree.result2
-rw-r--r--sql/sql_union.cc12
2 files changed, 8 insertions, 6 deletions
diff --git a/mysql-test/r/heap_btree.result b/mysql-test/r/heap_btree.result
index 0e8a32bd7b7..846a852738b 100644
--- a/mysql-test/r/heap_btree.result
+++ b/mysql-test/r/heap_btree.result
@@ -73,8 +73,8 @@ type=heap;
insert into t1 values (1,1),(2,2),(1,3),(2,4),(2,5),(2,6);
select * from t1 where x=1;
x y
-1 1
1 3
+1 1
select * from t1,t1 as t2 where t1.x=t2.y;
x y x y
1 1 1 1
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index 01b0eb9e6ec..eaeec2c1e68 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -109,7 +109,7 @@ int st_select_lex_unit::prepare(THD *thd, select_result *result)
if (prepared)
DBUG_RETURN(0);
prepared= 1;
-
+ union_result=0;
describe=(first_select()->options & SELECT_DESCRIBE) ? 1 : 0;
res= 0;
found_rows_for_union= false;
@@ -309,10 +309,12 @@ int st_select_lex_unit::exec()
int st_select_lex_unit::cleanup()
{
DBUG_ENTER("st_select_lex_unit::cleanup");
- delete union_result;
- free_tmp_table(thd,table);
- table= 0; // Safety
-
+ if (union_result)
+ {
+ delete union_result;
+ free_tmp_table(thd,table);
+ table= 0; // Safety
+ }
List_iterator<JOIN*> j(joins);
JOIN** join;
while ((join= j++))