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

Commit5b4ca67

Browse files
committed
Conditionally execute Junk filter only when ORDER BY of columns
not in target list.
1 parent62cd6e7 commit5b4ca67

File tree

1 file changed

+30
-10
lines changed

1 file changed

+30
-10
lines changed

‎src/backend/executor/execMain.c

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
*
2727
*
2828
* IDENTIFICATION
29-
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.48 1998/06/15 19:28:19 momjian Exp $
29+
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.49 1998/07/19 03:46:29 momjian Exp $
3030
*
3131
*-------------------------------------------------------------------------
3232
*/
@@ -522,18 +522,38 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
522522
* SELECT added by daveh@insightdist.com 5/20/98 to allow
523523
* ORDER/GROUP BY have an identifier missing from the target.
524524
*/
525-
if (operation==CMD_UPDATE||operation==CMD_DELETE||
526-
operation==CMD_INSERT||operation==CMD_SELECT)
527525
{
528-
JunkFilter*j= (JunkFilter*)ExecInitJunkFilter(targetList);
529-
estate->es_junkFilter=j;
530-
526+
booljunk_filter_needed= false;
527+
List*tlist;
528+
531529
if (operation==CMD_SELECT)
532-
tupType=j->jf_cleanTupType;
533-
}
534-
else
535-
estate->es_junkFilter=NULL;
530+
{
531+
foreach(tlist,targetList)
532+
{
533+
TargetEntry*tle=lfirst(tlist);
534+
535+
if (tle->resdom->resjunk)
536+
{
537+
junk_filter_needed= true;
538+
break;
539+
}
540+
}
541+
}
542+
543+
if (operation==CMD_UPDATE||operation==CMD_DELETE||
544+
operation==CMD_INSERT||
545+
(operation==CMD_SELECT&&junk_filter_needed))
546+
{
547+
JunkFilter*j= (JunkFilter*)ExecInitJunkFilter(targetList);
548+
estate->es_junkFilter=j;
536549

550+
if (operation==CMD_SELECT)
551+
tupType=j->jf_cleanTupType;
552+
}
553+
else
554+
estate->es_junkFilter=NULL;
555+
}
556+
537557
/* ----------------
538558
*initialize the "into" relation
539559
* ----------------

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp