mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-12 18:34:36 +08: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:
parent
bf00bbb0c4
commit
128d827d4b
@ -404,12 +404,20 @@ SS_process_sublinks(Node *expr)
|
|||||||
((Expr *) expr)->args = (List *)
|
((Expr *) expr)->args = (List *)
|
||||||
SS_process_sublinks((Node *) ((Expr *) expr)->args);
|
SS_process_sublinks((Node *) ((Expr *) expr)->args);
|
||||||
else if (IsA(expr, SubLink))/* got it! */
|
else if (IsA(expr, SubLink))/* got it! */
|
||||||
{
|
{
|
||||||
lfirst(((Expr *) lfirst(((SubLink *)expr)->oper))->args) =
|
/* Hack to make sure expr->oper->args points to the same VAR node
|
||||||
lfirst(((SubLink *)expr)->lefthand);
|
* 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);
|
expr = _make_subplan((SubLink *) expr);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (expr);
|
return (expr);
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ queries, like <I>INSERT</I> and <I>UPDATE,</I> specify the columns
|
|||||||
modified by the query. These column references are converted to <A
|
modified by the query. These column references are converted to <A
|
||||||
HREF="../../include/nodes/primnodes.h">Resdom</A> entries, which are
|
HREF="../../include/nodes/primnodes.h">Resdom</A> entries, which are
|
||||||
placed in <A HREF="../../include/nodes/parsenodes.h">target list
|
placed in <A HREF="../../include/nodes/parsenodes.h">target list
|
||||||
entries,</I> and linked together to make up the <I>target list</I> of
|
entries,</A> and linked together to make up the <I>target list</I> of
|
||||||
the query. The target list is stored in Query.targetList, which is
|
the query. The target list is stored in Query.targetList, which is
|
||||||
generated by <A
|
generated by <A
|
||||||
HREF="../../backend/parser/parse_target.c">transformTargetList().</A><P>
|
HREF="../../backend/parser/parse_target.c">transformTargetList().</A><P>
|
||||||
|
Loading…
Reference in New Issue
Block a user