Skip to content

Commit 7cac502

Browse files
committed
Avoid unnecessary call of rangeTableEntry_used() for the result relation
of a query.
1 parent d66daab commit 7cac502

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/backend/rewrite/rewriteHandler.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/backend/rewrite/rewriteHandler.c,v 1.151 2005/04/28 21:47:14 tgl Exp $
10+
* $PostgreSQL: pgsql/src/backend/rewrite/rewriteHandler.c,v 1.152 2005/05/29 18:34:57 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -699,7 +699,6 @@ ApplyRetrieveRule(Query *parsetree,
699699
int rt_index,
700700
bool relation_level,
701701
Relation relation,
702-
bool relIsUsed,
703702
List *activeRIRs)
704703
{
705704
Query *rule_action;
@@ -870,7 +869,6 @@ fireRIRrules(Query *parsetree, List *activeRIRs)
870869
RuleLock *rules;
871870
RewriteRule *rule;
872871
LOCKMODE lockmode;
873-
bool relIsUsed;
874872
int i;
875873

876874
++rt_index;
@@ -901,9 +899,8 @@ fireRIRrules(Query *parsetree, List *activeRIRs)
901899
* part of the join set (a source table), or is referenced by any
902900
* Var nodes, or is the result table.
903901
*/
904-
relIsUsed = rangeTableEntry_used((Node *) parsetree, rt_index, 0);
905-
906-
if (!relIsUsed && rt_index != parsetree->resultRelation)
902+
if (rt_index != parsetree->resultRelation &&
903+
!rangeTableEntry_used((Node *) parsetree, rt_index, 0))
907904
continue;
908905

909906
/*
@@ -978,7 +975,6 @@ fireRIRrules(Query *parsetree, List *activeRIRs)
978975
rt_index,
979976
rule->attrno == -1,
980977
rel,
981-
relIsUsed,
982978
activeRIRs);
983979
}
984980

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy