MXS-1307 Tweak cte tests

The "parser" of compare cannot handle the following:

  prepare stmt1 from "
  with t as (select a from t1 where b >= 'c')
    select * from t2,t where t2.c=t.a;
  ";

That is, that a line *not* terminating the full statement (the
line 'select * from t2,t where t2.c=t.a;' above) ends with a ';'.
Thus, it needs to be changed into e.g.

  prepare stmt1 from "
  with t as (select a from t1 where b >= 'c')
    select * from t2,t where t2.c=t.a;";
This commit is contained in:
Johan Wikman 2017-08-08 09:37:05 +03:00
parent a02bc3d40b
commit fdb588b866
2 changed files with 9 additions and 18 deletions

View File

@ -351,8 +351,7 @@ drop view v1;
--echo # prepare of a query containing a definition of a with table t
prepare stmt1 from "
with t as (select a from t1 where b >= 'c')
select * from t2,t where t2.c=t.a;
";
select * from t2,t where t2.c=t.a;";
execute stmt1;
execute stmt1;
deallocate prepare stmt1;
@ -360,8 +359,7 @@ deallocate prepare stmt1;
--echo # prepare of a query containing a definition of a materialized t
prepare stmt1 from "
with t as (select a, count(*) from t1 where b >= 'c' group by a)
select * from t2,t where t2.c=t.a;
";
select * from t2,t where t2.c=t.a;";
execute stmt1;
execute stmt1;
deallocate prepare stmt1;
@ -369,8 +367,7 @@ deallocate prepare stmt1;
--echo # prepare of a query containing two references to with table t
prepare stmt1 from "
with t as (select * from t1 where b >= 'c')
select * from t as r1, t as r2 where r1.a=r2.a;
";
select * from t as r1, t as r2 where r1.a=r2.a;";
execute stmt1;
execute stmt1;
deallocate prepare stmt1;

View File

@ -674,8 +674,7 @@ as
from folks as p, ancestors AS a
where p.id = a.father or p.id = a.mother
)
select * from ancestors;
";
select * from ancestors;";
execute stmt1;
execute stmt1;
@ -1218,8 +1217,7 @@ as
union
select mother from folks, ancestor_ids a where folks.id = a.id
)
select p.* from folks as p, ancestor_ids as a where p.id = a.id;
";
select p.* from folks as p, ancestor_ids as a where p.id = a.id;";
execute stmt;
deallocate prepare stmt;
@ -1242,8 +1240,7 @@ as
union
select mother from folks, ancestor_ids a where folks.id = a.id
)
select p.* from folks as p, ancestor_ids as a where p.id = a.id;
";
select p.* from folks as p, ancestor_ids as a where p.id = a.id;";
execute stmt;
deallocate prepare stmt;
select * from my_ancestors;
@ -1264,8 +1261,7 @@ as
union
select mother from folks, ancestor_ids a where folks.id = a.id
)
select p.* from folks as p, ancestor_ids as a where p.id = a.id;
";
select p.* from folks as p, ancestor_ids as a where p.id = a.id;";
execute stmt;
deallocate prepare stmt;
select * from my_ancestors;
@ -1718,8 +1714,7 @@ reachables(p) as
select p from reachables where p > 'p5') and
t1.lp = reachables.p
)
select * from reachables;
";
select * from reachables;";
execute stmt;
execute stmt;
@ -1821,8 +1816,7 @@ applied_modules as
module_arguments.v not in
(select v from reached_objects))
)
select * from reached_objects;
";
select * from reached_objects;";
execute stmt;
execute stmt;