Below is the list of changes that have just been committed into a local
4.1 repository of bell. When bell does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://www.mysql.com/doc/I/n/Installing_source_tree.html
ChangeSet
1.1376 02/10/26 17:21:09 bell@xxxxxxxxxxxxxxx +4 -0
fixed thd->lex.select restoring
explain UNION subselect bug
sql/sql_union.cc
1.44 02/10/26 17:21:08 bell@xxxxxxxxxxxxxxx +5 -4
fixed thd->lex.select restoring
sql/sql_select.cc
1.189 02/10/26 17:21:08 bell@xxxxxxxxxxxxxxx +15 -9
fixed explain UNION subselect bug
mysql-test/t/subselect.test
1.21 02/10/26 17:21:07 bell@xxxxxxxxxxxxxxx +1 -0
test for explain UNION subselect
mysql-test/r/subselect.result
1.22 02/10/26 17:21:07 bell@xxxxxxxxxxxxxxx +5 -0
test for explain UNION subselect
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: bell
# Host: sanja.is.com.ua
# Root: /home/bell/mysql/work-union_crash-4.1
--- 1.188/sql/sql_select.cc Sat Oct 26 13:26:51 2002
+++ 1.189/sql/sql_select.cc Sat Oct 26 17:21:08 2002
@@ -7251,16 +7251,18 @@
select_result *result=join->result;
Item *item_null= new Item_null();
DBUG_ENTER("select_describe");
-
+ DBUG_PRINT("info", ("Select 0x%lx, type %s, message %s",
+ (ulong)join->select_lex, join->select_lex->type,
+ message));
/* Don't log this into the slow query log */
select_lex->options&= ~(QUERY_NO_INDEX_USED | QUERY_NO_GOOD_INDEX_USED);
join->unit->offset_limit_cnt= 0;
if (message)
{
- item_list.push_back(new Item_int((int32) thd->lex.select->select_number));
- item_list.push_back(new Item_string(thd->lex.select->type,
- strlen(thd->lex.select->type),
+ item_list.push_back(new Item_int((int32) join->select_lex->select_number));
+ item_list.push_back(new Item_string(join->select_lex->type,
+ strlen(join->select_lex->type),
default_charset_info));
Item *empty= new Item_empty_string("",0);
for (uint i=0 ; i < 7; i++)
@@ -7285,9 +7287,10 @@
tmp2.length(0);
item_list.empty();
- item_list.push_back(new Item_int((int32)
thd->lex.select->select_number));
- item_list.push_back(new Item_string(thd->lex.select->type,
- strlen(thd->lex.select->type),
+ item_list.push_back(new Item_int((int32)
+ join->select_lex->select_number));
+ item_list.push_back(new Item_string(join->select_lex->type,
+ strlen(join->select_lex->type),
default_charset_info));
if (tab->type == JT_ALL && tab->select && tab->select->quick)
tab->type= JT_RANGE;
@@ -7445,6 +7448,7 @@
int mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result)
{
+ DBUG_ENTER("mysql_explain_union");
int res= 0;
SELECT_LEX *first= unit->first_select();
for (SELECT_LEX *sl= first;
@@ -7467,12 +7471,14 @@
}
if (res > 0)
res= -res; // mysql_explain_select do not report error
- return res;
+ DBUG_RETURN(res);
}
int mysql_explain_select(THD *thd, SELECT_LEX *select_lex, char const *type,
select_result *result)
{
+ DBUG_ENTER("mysql_explain_select");
+ DBUG_PRINT("info", ("Select 0x%lx, type %s", (ulong)select_lex, type))
select_lex->type= type;
thd->lex.select= select_lex;
SELECT_LEX_UNIT *unit= select_lex->master_unit();
@@ -7485,6 +7491,6 @@
(ORDER*) thd->lex.proc_list.first,
select_lex->options | thd->options | SELECT_DESCRIBE,
result, unit, select_lex, 0);
- return res;
+ DBUG_RETURN(res);
}
--- 1.43/sql/sql_union.cc Sat Oct 26 13:26:51 2002
+++ 1.44/sql/sql_union.cc Sat Oct 26 17:21:08 2002
@@ -198,11 +198,12 @@
int st_select_lex_unit::exec()
{
DBUG_ENTER("st_select_lex_unit::exec");
+ SELECT_LEX *lex_select_save= thd->lex.select;
+
if(depended || !item || !item->assigned())
{
if (optimized && item && item->assigned())
item->assigned(0); // We will reinit & rexecute unit
- SELECT_LEX *lex_select_save= thd->lex.select;
for (SELECT_LEX *sl= first_select(); sl; sl= sl->next_select())
{
thd->lex.select=sl;
@@ -229,14 +230,13 @@
DBUG_RETURN(res);
}
}
- thd->lex.select= lex_select_save;
optimized= 1;
}
if (union_result->flush())
{
- res= 1; // Error is already sent
- DBUG_RETURN(res);
+ thd->lex.select= lex_select_save;
+ DBUG_RETURN(1);
}
/* Send result to 'result' */
@@ -279,6 +279,7 @@
}
}
thd->lex.select_lex.ftfunc_list= &thd->lex.select_lex.ftfunc_list_alloc;
+ thd->lex.select= lex_select_save;
DBUG_RETURN(res);
}
--- 1.21/mysql-test/r/subselect.result Sat Oct 26 13:26:51 2002
+++ 1.22/mysql-test/r/subselect.result Sat Oct 26 17:21:07 2002
@@ -211,4 +211,9 @@
1
SELECT 1 FROM searchconthardwarefr3 WHERE 1=(SELECT 1 UNION ALL SELECT 1)
UNION SELECT 1;
Subselect returns more than 1 record
+EXPLAIN SELECT 1 FROM searchconthardwarefr3 WHERE 1=(SELECT 1 UNION SELECT 1);
+id select_type table type possible_keys key key_len ref
rows Extra
+1 PRIMARY searchconthardwarefr3 index NULL topic 3 NULL
2 Using index
+2 SUBSELECT
No tables used
+3 UNION No
tables used
drop table searchconthardwarefr3;
--- 1.20/mysql-test/t/subselect.test Sat Oct 26 13:26:51 2002
+++ 1.21/mysql-test/t/subselect.test Sat Oct 26 17:21:07 2002
@@ -113,4 +113,5 @@
SELECT 1 FROM searchconthardwarefr3 WHERE 1=(SELECT 1 UNION SELECT 1) UNION
ALL SELECT 1;
-- error 1240
SELECT 1 FROM searchconthardwarefr3 WHERE 1=(SELECT 1 UNION ALL SELECT 1)
UNION SELECT 1;
+EXPLAIN SELECT 1 FROM searchconthardwarefr3 WHERE 1=(SELECT 1 UNION SELECT 1);
drop table searchconthardwarefr3;
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail internals-thread5170@xxxxxxxxxxxxxxx
To unsubscribe, e-mail <internals-unsubscribe@xxxxxxxxxxxxxxx>
|