Commit a3a01679 authored by peter@mysql.com's avatar peter@mysql.com

Merge mysql.com:/home/pz/mysql/mysql-4.1-root

into mysql.com:/home/pz/mysql/mysql-4.1
parents 86f0ce87 7777d2b8
...@@ -5,6 +5,9 @@ SELECT (SELECT 1) UNION SELECT (SELECT 2); ...@@ -5,6 +5,9 @@ SELECT (SELECT 1) UNION SELECT (SELECT 2);
(SELECT 1) (SELECT 1)
1 1
2 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; drop table if exists t1,t2,t3,t4,t5,attend,clinic,inscrit;
create table t1 (a int); create table t1 (a int);
create table t2 (a int, b int); create table t2 (a int, b int);
......
select (select 2); select (select 2);
SELECT (SELECT 1) UNION 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; drop table if exists t1,t2,t3,t4,t5,attend,clinic,inscrit;
create table t1 (a int); create table t1 (a int);
create table t2 (a int, b int); create table t2 (a int, b int);
......
...@@ -251,3 +251,4 @@ ...@@ -251,3 +251,4 @@
"Key reference and table reference doesn't match", "Key reference and table reference doesn't match",
"Subselect returns more than 1 field", "Subselect returns more than 1 field",
"Subselect returns more than 1 record", "Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
...@@ -245,3 +245,4 @@ ...@@ -245,3 +245,4 @@
"Key reference and table reference doesn't match", "Key reference and table reference doesn't match",
"Subselect returns more than 1 field", "Subselect returns more than 1 field",
"Subselect returns more than 1 record", "Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
...@@ -253,3 +253,4 @@ ...@@ -253,3 +253,4 @@
"Key reference and table reference doesn't match", "Key reference and table reference doesn't match",
"Subselect returns more than 1 field", "Subselect returns more than 1 field",
"Subselect returns more than 1 record", "Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
...@@ -247,3 +247,4 @@ ...@@ -247,3 +247,4 @@
"Key reference and table reference doesn't match", "Key reference and table reference doesn't match",
"Subselect returns more than 1 field", "Subselect returns more than 1 field",
"Subselect returns more than 1 record", "Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
...@@ -242,3 +242,4 @@ ...@@ -242,3 +242,4 @@
"Key reference and table reference doesn't match", "Key reference and table reference doesn't match",
"Subselect returns more than 1 field", "Subselect returns more than 1 field",
"Subselect returns more than 1 record", "Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
...@@ -245,3 +245,4 @@ ...@@ -245,3 +245,4 @@
"Key reference and table reference doesn't match", "Key reference and table reference doesn't match",
"Subselect return more than 1 field", "Subselect return more than 1 field",
"Subselect return more than 1 record", "Subselect return more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
...@@ -242,3 +242,4 @@ ...@@ -242,3 +242,4 @@
"Key reference and table reference doesn't match", "Key reference and table reference doesn't match",
"Subselect returns more than 1 field", "Subselect returns more than 1 field",
"Subselect returns more than 1 record", "Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
...@@ -244,3 +244,4 @@ ...@@ -244,3 +244,4 @@
"Key reference and table reference doesn't match", "Key reference and table reference doesn't match",
"Subselect returns more than 1 field", "Subselect returns more than 1 field",
"Subselect returns more than 1 record", "Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
...@@ -242,3 +242,4 @@ ...@@ -242,3 +242,4 @@
"Key reference and table reference doesn't match", "Key reference and table reference doesn't match",
"Subselect returns more than 1 field", "Subselect returns more than 1 field",
"Subselect returns more than 1 record", "Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
...@@ -244,3 +244,4 @@ ...@@ -244,3 +244,4 @@
"Key reference and table reference doesn't match", "Key reference and table reference doesn't match",
"Subselect returns more than 1 field", "Subselect returns more than 1 field",
"Subselect returns more than 1 record", "Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
...@@ -242,3 +242,4 @@ ...@@ -242,3 +242,4 @@
"Key reference and table reference doesn't match", "Key reference and table reference doesn't match",
"Subselect returns more than 1 field", "Subselect returns more than 1 field",
"Subselect returns more than 1 record", "Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
...@@ -244,3 +244,4 @@ ...@@ -244,3 +244,4 @@
"Key reference and table reference doesn't match", "Key reference and table reference doesn't match",
"Subselect returns more than 1 field", "Subselect returns more than 1 field",
"Subselect returns more than 1 record", "Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
...@@ -244,3 +244,4 @@ ...@@ -244,3 +244,4 @@
"Key reference and table reference doesn't match", "Key reference and table reference doesn't match",
"Subselect returns more than 1 field", "Subselect returns more than 1 field",
"Subselect returns more than 1 record", "Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
...@@ -246,3 +246,4 @@ ...@@ -246,3 +246,4 @@
"Key reference and table reference doesn't match", "Key reference and table reference doesn't match",
"Subselect returns more than 1 field", "Subselect returns more than 1 field",
"Subselect returns more than 1 record", "Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
...@@ -242,3 +242,4 @@ ...@@ -242,3 +242,4 @@
"Key reference and table reference doesn't match", "Key reference and table reference doesn't match",
"Subselect returns more than 1 field", "Subselect returns more than 1 field",
"Subselect returns more than 1 record", "Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
...@@ -246,3 +246,4 @@ ...@@ -246,3 +246,4 @@
"Key reference and table reference doesn't match", "Key reference and table reference doesn't match",
"Subselect returns more than 1 field", "Subselect returns more than 1 field",
"Subselect returns more than 1 record", "Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
...@@ -245,3 +245,4 @@ ...@@ -245,3 +245,4 @@
"Key reference and table reference doesn't match", "Key reference and table reference doesn't match",
" ", " ",
" ", " ",
"Unknown prepared statement handler (%ld) given to %s",
...@@ -238,3 +238,4 @@ ...@@ -238,3 +238,4 @@
"Key reference and table reference doesn't match", "Key reference and table reference doesn't match",
"Subselect returns more than 1 field", "Subselect returns more than 1 field",
"Subselect returns more than 1 record", "Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
...@@ -250,3 +250,4 @@ ...@@ -250,3 +250,4 @@
"Key reference and table reference doesn't match", "Key reference and table reference doesn't match",
"Subselect returns more than 1 field", "Subselect returns more than 1 field",
"Subselect returns more than 1 record", "Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
...@@ -243,3 +243,4 @@ ...@@ -243,3 +243,4 @@
"Key reference and table reference doesn't match", "Key reference and table reference doesn't match",
"Subselect returns more than 1 field", "Subselect returns more than 1 field",
"Subselect returns more than 1 record", "Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
...@@ -242,3 +242,4 @@ ...@@ -242,3 +242,4 @@
"Key reference and table reference doesn't match", "Key reference and table reference doesn't match",
"Subselect returns more than 1 field", "Subselect returns more than 1 field",
"Subselect returns more than 1 record", "Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
...@@ -247,3 +247,4 @@ ...@@ -247,3 +247,4 @@
"Key reference and table reference doesn't match", "Key reference and table reference doesn't match",
"i i i 1 ", "i i i 1 ",
"i i i 1 ", "i i i 1 ",
"Unknown prepared statement handler (%ld) given to %s",
...@@ -945,7 +945,7 @@ void st_select_lex_unit::init_query() ...@@ -945,7 +945,7 @@ void st_select_lex_unit::init_query()
select_limit_cnt= HA_POS_ERROR; select_limit_cnt= HA_POS_ERROR;
offset_limit_cnt= 0; offset_limit_cnt= 0;
union_option= 0; union_option= 0;
prepared= optimized= 0; prepared= optimized= executed= 0;
item= 0; item= 0;
} }
......
...@@ -227,8 +227,9 @@ protected: ...@@ -227,8 +227,9 @@ protected:
select_result *result; select_result *result;
int res; int res;
bool describe, found_rows_for_union, bool describe, found_rows_for_union,
prepared, //prepare phase already performed for UNION (unit) prepared, // prepare phase already performed for UNION (unit)
optimized; // optimize phase already performed for UNION (unit) optimized, // optimize phase already performed for UNION (unit)
executed; // already executed
public: public:
/* /*
Pointer to 'last' select or pointer to unit where stored Pointer to 'last' select or pointer to unit where stored
......
...@@ -199,8 +199,12 @@ int st_select_lex_unit::exec() ...@@ -199,8 +199,12 @@ int st_select_lex_unit::exec()
{ {
DBUG_ENTER("st_select_lex_unit::exec"); DBUG_ENTER("st_select_lex_unit::exec");
SELECT_LEX *lex_select_save= thd->lex.select; 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()) if (optimized && item && item->assigned())
item->assigned(0); // We will reinit & rexecute unit item->assigned(0); // We will reinit & rexecute unit
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment