Make tests fail with a useful error message

pull/3389/head
Jelte Fennema 2020-01-16 16:42:08 +01:00
parent cb5154cf03
commit 0ee1eab070
2 changed files with 14 additions and 12 deletions

View File

@ -281,21 +281,23 @@ JoinTreeContainsSubqueryWalker(Node *joinTreeNode, void *context)
bool bool
WhereOrHavingClauseContainsSubquery(Query *query) WhereOrHavingClauseContainsSubquery(Query *query)
{ {
FromExpr *joinTree = query->jointree;
if (FindNodeCheck(query->havingQual, IsNodeSubquery)) if (FindNodeCheck(query->havingQual, IsNodeSubquery))
{ {
return true; return true;
} }
if (!joinTree) if (!query->jointree)
{ {
return false; return false;
} }
Node *queryQuals = joinTree->quals; /*
* We search the whole jointree here, not just the quals. The reason for
return FindNodeCheck(queryQuals, IsNodeSubquery); * this is that the fromlist can contain other FromExpr nodes again or
* JoinExpr nodes that also have quals. If that's the case we need to check
* those as well if they contain andy subqueries.
*/
return FindNodeCheck((Node *) query->jointree, IsNodeSubquery);
} }

View File

@ -140,8 +140,10 @@ select s_i_id
where where
s_i_id in (select i_id from item) s_i_id in (select i_id from item)
AND s_i_id not in (select i_im_id from item); AND s_i_id not in (select i_im_id from item);
ERROR: syntax error at or near "SubPlan" s_i_id
CONTEXT: while executing command on localhost:xxxxx ---------------------------------------------------------------------
(0 rows)
-- Subquery + repartion is not supported when it contains both an IN and a NOT IN -- Subquery + repartion is not supported when it contains both an IN and a NOT IN
-- where both subqueries return unique results -- where both subqueries return unique results
select s_i_id select s_i_id
@ -150,8 +152,7 @@ select s_i_id
s_i_id in (select i_id from item) s_i_id in (select i_id from item)
AND s_i_id not in (select i_id from item) AND s_i_id not in (select i_id from item)
AND s_i_id = ol_i_id; AND s_i_id = ol_i_id;
ERROR: syntax error at or near "SubPlan" ERROR: complex joins are only supported when all distributed tables are co-located and joined on their distribution columns
CONTEXT: while executing command on localhost:xxxxx
-- Subquery + repartion is not supported when it contains both an IN and a NOT IN -- Subquery + repartion is not supported when it contains both an IN and a NOT IN
-- where the IN subquery returns unique results and the NOT IN returns non unique results -- where the IN subquery returns unique results and the NOT IN returns non unique results
select s_i_id select s_i_id
@ -160,8 +161,7 @@ select s_i_id
s_i_id in (select i_id from item) s_i_id in (select i_id from item)
AND s_i_id not in (select i_im_id from item) AND s_i_id not in (select i_im_id from item)
AND s_i_id = ol_i_id; AND s_i_id = ol_i_id;
ERROR: syntax error at or near "SubPlan" ERROR: complex joins are only supported when all distributed tables are co-located and joined on their distribution columns
CONTEXT: while executing command on localhost:xxxxx
-- Subquery + repartion is not supported when it contains both an IN and a NOT IN -- Subquery + repartion is not supported when it contains both an IN and a NOT IN
-- where the IN subquery returns non unique results and the NOT IN returns unique results -- where the IN subquery returns non unique results and the NOT IN returns unique results
select s_i_id select s_i_id