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
WhereOrHavingClauseContainsSubquery(Query *query)
{
FromExpr *joinTree = query->jointree;
if (FindNodeCheck(query->havingQual, IsNodeSubquery))
{
return true;
}
if (!joinTree)
if (!query->jointree)
{
return false;
}
Node *queryQuals = joinTree->quals;
return FindNodeCheck(queryQuals, IsNodeSubquery);
/*
* We search the whole jointree here, not just the quals. The reason for
* 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
s_i_id in (select i_id from item)
AND s_i_id not in (select i_im_id from item);
ERROR: syntax error at or near "SubPlan"
CONTEXT: while executing command on localhost:xxxxx
s_i_id
---------------------------------------------------------------------
(0 rows)
-- Subquery + repartion is not supported when it contains both an IN and a NOT IN
-- where both subqueries return unique results
select s_i_id
@ -150,8 +152,7 @@ select s_i_id
s_i_id in (select i_id from item)
AND s_i_id not in (select i_id from item)
AND s_i_id = ol_i_id;
ERROR: syntax error at or near "SubPlan"
CONTEXT: while executing command on localhost:xxxxx
ERROR: complex joins are only supported when all distributed tables are co-located and joined on their distribution columns
-- 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
select s_i_id
@ -160,8 +161,7 @@ select s_i_id
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 = ol_i_id;
ERROR: syntax error at or near "SubPlan"
CONTEXT: while executing command on localhost:xxxxx
ERROR: complex joins are only supported when all distributed tables are co-located and joined on their distribution columns
-- 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
select s_i_id