1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

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

This commit is contained in:
Galina Shalygina
2016-05-10 22:32:02 +03:00
parent f516b966e1
commit d0e973a3b0
6 changed files with 26 additions and 20 deletions

View File

@@ -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), s as (select a from t1,r where t1.a>r.c),
r as (select c from t,t2 where t.a=t2.c) r as (select c from t,t2 where t.a=t2.c)
select * from r where r.c<7; select * from r where r.c<7;
ERROR HY000: Recursive queries in WITH clause are not supported yet ERROR HY000: No anchors for recursive WITH element 't'
with t as (select * from s where a>2), with recursive
t as (select * from s where a>2),
s as (select a from t1,r where t1.a>r.c), s as (select a from t1,r where t1.a>r.c),
r as (select c from t,t2 where t.a=t2.c) r as (select c from t,t2 where t.a=t2.c)
select * from r where r.c<7; select * from r where r.c<7;
ERROR HY000: Recursive queries in WITH clause are not supported yet ERROR HY000: No anchors for recursive WITH element 't'
with t as (select * from t1 with recursive
t as (select * from t1
where a in (select c from s where b<='ccc') and b>'b'), where a in (select c from s where b<='ccc') and b>'b'),
s as (select * from t1,t2 s as (select * from t1,t2
where t1.a=t2.c and t1.c in (select a from t where a<5)) where t1.a=t2.c and t1.c in (select a from t where a<5))
select * from s where s.b>'aaa'; select * from s where s.b>'aaa';
ERROR HY000: Recursive queries in WITH clause are not supported yet ERROR HY000: No anchors for recursive WITH element 't'
with t as (select * from t1 where b>'aaa' and b <='d') with recursive
t as (select * from t1 where b>'aaa' and b <='d')
select t.b from t,t2 select t.b from t,t2
where t.a=t2.c and 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') t2.c in (with s as (select t1.a from s,t1 where t1.a=s.a and t1.b<'c')
select * from s); 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 #erroneous definition of unreferenced with table t
with t as (select count(*) from t1 where d>='f' group by a) with t as (select count(*) from t1 where d>='f' group by a)
select t1.b from t2,t1 where t1.a = t2.c; select t1.b from t2,t1 where t1.a = t2.c;

View File

@@ -376,27 +376,30 @@ with recursive
s as (select a from t1 where b>='d') s as (select a from t1 where b>='d')
select * from t,s where t.a=s.a; 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), with recursive t as (select * from s where a>2),
s as (select a from t1,r where t1.a>r.c), s as (select a from t1,r where t1.a>r.c),
r as (select c from t,t2 where t.a=t2.c) r as (select c from t,t2 where t.a=t2.c)
select * from r where r.c<7; select * from r where r.c<7;
--ERROR ER_RECURSIVE_QUERY_IN_WITH_CLAUSE --ERROR ER_RECURSIVE_WITHOUT_ANCHORS
with t as (select * from s where a>2), with recursive
t as (select * from s where a>2),
s as (select a from t1,r where t1.a>r.c), s as (select a from t1,r where t1.a>r.c),
r as (select c from t,t2 where t.a=t2.c) r as (select c from t,t2 where t.a=t2.c)
select * from r where r.c<7; select * from r where r.c<7;
--ERROR ER_RECURSIVE_QUERY_IN_WITH_CLAUSE --ERROR ER_RECURSIVE_WITHOUT_ANCHORS
with t as (select * from t1 with recursive
t as (select * from t1
where a in (select c from s where b<='ccc') and b>'b'), where a in (select c from s where b<='ccc') and b>'b'),
s as (select * from t1,t2 s as (select * from t1,t2
where t1.a=t2.c and t1.c in (select a from t where a<5)) where t1.a=t2.c and t1.c in (select a from t where a<5))
select * from s where s.b>'aaa'; select * from s where s.b>'aaa';
--ERROR ER_RECURSIVE_QUERY_IN_WITH_CLAUSE --ERROR ER_RECURSIVE_WITHOUT_ANCHORS
with t as (select * from t1 where b>'aaa' and b <='d') with recursive
t as (select * from t1 where b>'aaa' and b <='d')
select t.b from t,t2 select t.b from t,t2
where t.a=t2.c and 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') t2.c in (with s as (select t1.a from s,t1 where t1.a=s.a and t1.b<'c')

View File

@@ -4,7 +4,7 @@ insert into t1 values
insert into t1 values insert into t1 values
(3,'eee'), (7,'bb'), (1,'fff'), (4,'ggg'); (3,'eee'), (7,'bb'), (1,'fff'), (4,'ggg');
--ERROR 1984 --ERROR ER_RECURSIVE_WITHOUT_ANCHORS
with recursive with recursive
a1(a,b) as a1(a,b) as
(select * from t1 where t1.a>3 (select * from t1 where t1.a>3

View File

@@ -7152,13 +7152,10 @@ ER_DUP_QUERY_NAME
eng "Duplicate query name in WITH clause" eng "Duplicate query name in WITH clause"
ER_WRONG_ORDER_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" 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 ER_RECURSIVE_WITHOUT_ANCHORS
eng "No anchors for recursive WITH element '%s'" eng "No anchors for recursive WITH element '%s'"
ER_REF_TO_RECURSIVE_WITH_TABLE_IN_DERIVED ER_REF_TO_RECURSIVE_WITH_TABLE_IN_DERIVED
eng "Reference to recursive WITH table '%s' in materiazed derived" eng "Reference to recursive WITH table '%s' in materiazed derived"
# #
# Internal errors, not used # Internal errors, not used
# #

View File

@@ -636,6 +636,9 @@ bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived)
bool res= FALSE; bool res= FALSE;
DBUG_PRINT("enter", ("unit 0x%lx", (ulong) unit)); DBUG_PRINT("enter", ("unit 0x%lx", (ulong) unit));
if (!unit)
DBUG_RETURN(FALSE);
SELECT_LEX *first_select= unit->first_select(); SELECT_LEX *first_select= unit->first_select();
if (unit->prepared && derived->is_recursive_with_table() && 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 // Skip already prepared views/DT
if (!unit || unit->prepared || if (unit->prepared ||
(derived->merged_for_insert && (derived->merged_for_insert &&
!(derived->is_multitable() && !(derived->is_multitable() &&
(thd->lex->sql_command == SQLCOM_UPDATE_MULTI || (thd->lex->sql_command == SQLCOM_UPDATE_MULTI ||

View File

@@ -1285,7 +1285,7 @@ bool st_select_lex_unit::cleanup()
if (with_element && with_element->is_recursive) if (with_element && with_element->is_recursive)
with_element->mark_as_cleaned(); with_element->mark_as_cleaned();
if (union_result && !(with_element->is_recursive)) if (union_result && !(with_element &&with_element->is_recursive))
{ {
delete union_result; delete union_result;
union_result=0; // Safety union_result=0; // Safety