1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-14 08:21:07 +03:00

I'm sorry, but I think I introduced a little bug with my last patch.

Everyone using an [NOT] EXISTS subquery will have noticed that
already.

The bug is in "subselect.c" in the function "SS_process_sublinks()".

Here the whole function as it *SHOULD BE*:

Stephan
This commit is contained in:
Bruce Momjian
1998-07-24 04:03:10 +00:00
parent bf00bbb0c4
commit 128d827d4b
2 changed files with 14 additions and 6 deletions

View File

@ -404,12 +404,20 @@ SS_process_sublinks(Node *expr)
((Expr *) expr)->args = (List *)
SS_process_sublinks((Node *) ((Expr *) expr)->args);
else if (IsA(expr, SubLink))/* got it! */
{
lfirst(((Expr *) lfirst(((SubLink *)expr)->oper))->args) =
lfirst(((SubLink *)expr)->lefthand);
{
/* Hack to make sure expr->oper->args points to the same VAR node
* as expr->lefthand does. Needed for subselects in the havingQual
* when used on views.
* Otherwise aggregate functions will fail later on (at execution
* time!) Reason: The rewite System makes several copies of the
* VAR nodes and in this case it should not do so :-( */
if(expr->lefthand != NULL)
{
lfirst(((Expr *) lfirst(((SubLink *)expr)->oper))->args) =
lfirst(((SubLink *)expr)->lefthand);
}
expr = _make_subplan((SubLink *) expr);
}
}
return (expr);
}