Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit128d827

Browse files
committed
I'm sorry, but I think I introduced a little bug with my last patch.
Everyone using an [NOT] EXISTS subquery will have noticed thatalready.The bug is in "subselect.c" in the function "SS_process_sublinks()".Here the whole function as it *SHOULD BE*:Stephan
1 parentbf00bbb commit128d827

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

‎src/backend/optimizer/plan/subselect.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -404,12 +404,20 @@ SS_process_sublinks(Node *expr)
404404
((Expr*)expr)->args= (List*)
405405
SS_process_sublinks((Node*) ((Expr*)expr)->args);
406406
elseif (IsA(expr,SubLink))/* got it! */
407-
{
408-
lfirst(((Expr*)lfirst(((SubLink*)expr)->oper))->args)=
409-
lfirst(((SubLink*)expr)->lefthand);
410-
407+
{
408+
/* Hack to make sure expr->oper->args points to the same VAR node
409+
* as expr->lefthand does. Needed for subselects in the havingQual
410+
* when used on views.
411+
* Otherwise aggregate functions will fail later on (at execution
412+
* time!) Reason: The rewite System makes several copies of the
413+
* VAR nodes and in this case it should not do so :-( */
414+
if(expr->lefthand!=NULL)
415+
{
416+
lfirst(((Expr*)lfirst(((SubLink*)expr)->oper))->args)=
417+
lfirst(((SubLink*)expr)->lefthand);
418+
}
411419
expr=_make_subplan((SubLink*)expr);
412-
}
420+
}
413421

414422
return (expr);
415423
}

‎src/tools/backend/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ <H2 ALIGN=CENTER>
7878
modified by the query. These column references are converted to<A
7979
HREF="../../include/nodes/primnodes.h">Resdom</A> entries, which are
8080
placed in<AHREF="../../include/nodes/parsenodes.h">target list
81-
entries,</I> and linked together to make up the<I>target list</I> of
81+
entries,</A> and linked together to make up the<I>target list</I> of
8282
the query. The target list is stored in Query.targetList, which is
8383
generated by<A
8484
HREF="../../backend/parser/parse_target.c">transformTargetList().</A><P>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp