1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

fixed union rexecution bug

This commit is contained in:
bell@sanja.is.com.ua
2002-10-27 21:29:40 +02:00
parent 8ec9edac55
commit 7777d2b819
5 changed files with 14 additions and 6 deletions

View File

@ -5,6 +5,9 @@ SELECT (SELECT 1) UNION SELECT (SELECT 2);
(SELECT 1)
1
2
SELECT (SELECT (SELECT 0 UNION SELECT 0));
(SELECT (SELECT 0 UNION SELECT 0))
0
drop table if exists t1,t2,t3,t4,t5,attend,clinic,inscrit;
create table t1 (a int);
create table t2 (a int, b int);

View File

@ -1,6 +1,6 @@
select (select 2);
SELECT (SELECT 1) UNION SELECT (SELECT 2);
SELECT (SELECT (SELECT 0 UNION SELECT 0));
drop table if exists t1,t2,t3,t4,t5,attend,clinic,inscrit;
create table t1 (a int);
create table t2 (a int, b int);

View File

@ -945,7 +945,7 @@ void st_select_lex_unit::init_query()
select_limit_cnt= HA_POS_ERROR;
offset_limit_cnt= 0;
union_option= 0;
prepared= optimized= 0;
prepared= optimized= executed= 0;
item= 0;
}

View File

@ -227,8 +227,9 @@ protected:
select_result *result;
int res;
bool describe, found_rows_for_union,
prepared, //prepare phase already performed for UNION (unit)
optimized; // optimize phase already performed for UNION (unit)
prepared, // prepare phase already performed for UNION (unit)
optimized, // optimize phase already performed for UNION (unit)
executed; // already executed
public:
/*
Pointer to 'last' select or pointer to unit where stored

View File

@ -200,7 +200,11 @@ 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 (executed && !depended)
DBUG_RETURN(0);
executed= 1;
if (depended || !item || !item->assigned())
{
if (optimized && item && item->assigned())
item->assigned(0); // We will reinit & rexecute unit