Avoid unnecessary call of rangeTableEntry_used() for the result relation
of a query.
This commit is contained in:
parent
d66daabec9
commit
7cac50271d
@ -7,7 +7,7 @@
|
|||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/rewrite/rewriteHandler.c,v 1.151 2005/04/28 21:47:14 tgl Exp $
|
* $PostgreSQL: pgsql/src/backend/rewrite/rewriteHandler.c,v 1.152 2005/05/29 18:34:57 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -699,7 +699,6 @@ ApplyRetrieveRule(Query *parsetree,
|
|||||||
int rt_index,
|
int rt_index,
|
||||||
bool relation_level,
|
bool relation_level,
|
||||||
Relation relation,
|
Relation relation,
|
||||||
bool relIsUsed,
|
|
||||||
List *activeRIRs)
|
List *activeRIRs)
|
||||||
{
|
{
|
||||||
Query *rule_action;
|
Query *rule_action;
|
||||||
@ -870,7 +869,6 @@ fireRIRrules(Query *parsetree, List *activeRIRs)
|
|||||||
RuleLock *rules;
|
RuleLock *rules;
|
||||||
RewriteRule *rule;
|
RewriteRule *rule;
|
||||||
LOCKMODE lockmode;
|
LOCKMODE lockmode;
|
||||||
bool relIsUsed;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
++rt_index;
|
++rt_index;
|
||||||
@ -901,9 +899,8 @@ fireRIRrules(Query *parsetree, List *activeRIRs)
|
|||||||
* part of the join set (a source table), or is referenced by any
|
* part of the join set (a source table), or is referenced by any
|
||||||
* Var nodes, or is the result table.
|
* Var nodes, or is the result table.
|
||||||
*/
|
*/
|
||||||
relIsUsed = rangeTableEntry_used((Node *) parsetree, rt_index, 0);
|
if (rt_index != parsetree->resultRelation &&
|
||||||
|
!rangeTableEntry_used((Node *) parsetree, rt_index, 0))
|
||||||
if (!relIsUsed && rt_index != parsetree->resultRelation)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -978,7 +975,6 @@ fireRIRrules(Query *parsetree, List *activeRIRs)
|
|||||||
rt_index,
|
rt_index,
|
||||||
rule->attrno == -1,
|
rule->attrno == -1,
|
||||||
rel,
|
rel,
|
||||||
relIsUsed,
|
|
||||||
activeRIRs);
|
activeRIRs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user