Commit d0e973a3 authored by Galina Shalygina's avatar Galina Shalygina

Fixed merge problems to allow mysql-test suite 'main' to pass

parent f516b966
......@@ -691,24 +691,27 @@ with recursive t as (select * from s where a>2),
s as (select a from t1,r where t1.a>r.c),
r as (select c from t,t2 where t.a=t2.c)
select * from r where r.c<7;
ERROR HY000: Recursive queries in WITH clause are not supported yet
with t as (select * from s where a>2),
ERROR HY000: No anchors for recursive WITH element 't'
with recursive
t as (select * from s where a>2),
s as (select a from t1,r where t1.a>r.c),
r as (select c from t,t2 where t.a=t2.c)
select * from r where r.c<7;
ERROR HY000: Recursive queries in WITH clause are not supported yet
with t as (select * from t1
ERROR HY000: No anchors for recursive WITH element 't'
with recursive
t as (select * from t1
where a in (select c from s where b<='ccc') and b>'b'),
s as (select * from t1,t2
where t1.a=t2.c and t1.c in (select a from t where a<5))
select * from s where s.b>'aaa';
ERROR HY000: Recursive queries in WITH clause are not supported yet
with t as (select * from t1 where b>'aaa' and b <='d')
ERROR HY000: No anchors for recursive WITH element 't'
with recursive
t as (select * from t1 where b>'aaa' and b <='d')
select t.b from t,t2
where t.a=t2.c and
t2.c in (with s as (select t1.a from s,t1 where t1.a=s.a and t1.b<'c')
select * from s);
ERROR HY000: Recursive queries in WITH clause are not supported yet
ERROR HY000: No anchors for recursive WITH element 's'
#erroneous definition of unreferenced with table t
with t as (select count(*) from t1 where d>='f' group by a)
select t1.b from t2,t1 where t1.a = t2.c;
......
......@@ -376,27 +376,30 @@ with recursive
s as (select a from t1 where b>='d')
select * from t,s where t.a=s.a;
--ERROR ER_RECURSIVE_QUERY_IN_WITH_CLAUSE
--ERROR ER_RECURSIVE_WITHOUT_ANCHORS
with recursive t as (select * from s where a>2),
s as (select a from t1,r where t1.a>r.c),
r as (select c from t,t2 where t.a=t2.c)
select * from r where r.c<7;
--ERROR ER_RECURSIVE_QUERY_IN_WITH_CLAUSE
with t as (select * from s where a>2),
--ERROR ER_RECURSIVE_WITHOUT_ANCHORS
with recursive
t as (select * from s where a>2),
s as (select a from t1,r where t1.a>r.c),
r as (select c from t,t2 where t.a=t2.c)
select * from r where r.c<7;
--ERROR ER_RECURSIVE_QUERY_IN_WITH_CLAUSE
with t as (select * from t1
--ERROR ER_RECURSIVE_WITHOUT_ANCHORS
with recursive
t as (select * from t1
where a in (select c from s where b<='ccc') and b>'b'),
s as (select * from t1,t2
where t1.a=t2.c and t1.c in (select a from t where a<5))
select * from s where s.b>'aaa';
--ERROR ER_RECURSIVE_QUERY_IN_WITH_CLAUSE
with t as (select * from t1 where b>'aaa' and b <='d')
--ERROR ER_RECURSIVE_WITHOUT_ANCHORS
with recursive
t as (select * from t1 where b>'aaa' and b <='d')
select t.b from t,t2
where t.a=t2.c and
t2.c in (with s as (select t1.a from s,t1 where t1.a=s.a and t1.b<'c')
......
......@@ -4,7 +4,7 @@ insert into t1 values
insert into t1 values
(3,'eee'), (7,'bb'), (1,'fff'), (4,'ggg');
--ERROR 1984
--ERROR ER_RECURSIVE_WITHOUT_ANCHORS
with recursive
a1(a,b) as
(select * from t1 where t1.a>3
......
......@@ -7152,13 +7152,10 @@ ER_DUP_QUERY_NAME
eng "Duplicate query name in WITH clause"
ER_WRONG_ORDER_IN_WITH_CLAUSE
eng "The definition of the table '%s' refers to the table '%s' defined later in a non-recursive WITH clause"
ER_RECURSIVE_QUERY_IN_WITH_CLAUSE
eng "Recursive queries in WITH clause are not supported yet"
ER_RECURSIVE_WITHOUT_ANCHORS
eng "No anchors for recursive WITH element '%s'"
ER_REF_TO_RECURSIVE_WITH_TABLE_IN_DERIVED
eng "Reference to recursive WITH table '%s' in materiazed derived"
#
# Internal errors, not used
#
......
......@@ -636,6 +636,9 @@ bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived)
bool res= FALSE;
DBUG_PRINT("enter", ("unit 0x%lx", (ulong) unit));
if (!unit)
DBUG_RETURN(FALSE);
SELECT_LEX *first_select= unit->first_select();
if (unit->prepared && derived->is_recursive_with_table() &&
......@@ -665,7 +668,7 @@ bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived)
}
// Skip already prepared views/DT
if (!unit || unit->prepared ||
if (unit->prepared ||
(derived->merged_for_insert &&
!(derived->is_multitable() &&
(thd->lex->sql_command == SQLCOM_UPDATE_MULTI ||
......
......@@ -1285,7 +1285,7 @@ bool st_select_lex_unit::cleanup()
if (with_element && with_element->is_recursive)
with_element->mark_as_cleaned();
if (union_result && !(with_element->is_recursive))
if (union_result && !(with_element &&with_element->is_recursive))
{
delete union_result;
union_result=0; // Safety
......
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