pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Remove unused function argument
Date: Tue, 29 Oct 2019 10:21:32 +0100
Message-ID: <ec8a8b45-a30b-9193-cd4b-985d60d1497e@2ndquadrant.com> (raw)

The cache_plan argument to ri_PlanCheck has not been used since
e8c9fd5fdf768323911f7088e8287f63b513c3c6.  I propose to remove it.

That commit said "I left it alone in case there is any future need for 
it" but there hasn't been a need in 7 years, and I find it confusing to 
have an unused function argument without a clear purpose.  It would 
trivial to put it back if needed.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachments:

0001-Remove-unused-function-argument.patch (text/plain, 3.5K) download From 942a2a9fd19fdeb79e82b9849a55daf7fa5b9bff Mon Sep 17 00:00:00 2001 From: Peter Eisentraut <peter@eisentraut.org> Date: Tue, 29 Oct 2019 10:13:14 +0100 Subject: [PATCH] Remove unused function argument The cache_plan argument to ri_PlanCheck has not been used since e8c9fd5fdf768323911f7088e8287f63b513c3c6. --- src/backend/utils/adt/ri_triggers.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/src/backend/utils/adt/ri_triggers.c b/src/backend/utils/adt/ri_triggers.c index de0f810062..ef946d5ef5 100644 --- a/src/backend/utils/adt/ri_triggers.c +++ b/src/backend/utils/adt/ri_triggers.c @@ -210,8 +210,7 @@ static const RI_ConstraintInfo *ri_FetchConstraintInfo(Trigger *trigger, Relation trig_rel, bool rel_is_pk); static const RI_ConstraintInfo *ri_LoadConstraintInfo(Oid constraintOid); static SPIPlanPtr ri_PlanCheck(const char *querystr, int nargs, Oid *argtypes, - RI_QueryKey *qkey, Relation fk_rel, Relation pk_rel, - bool cache_plan); + RI_QueryKey *qkey, Relation fk_rel, Relation pk_rel); static bool ri_PerformCheck(const RI_ConstraintInfo *riinfo, RI_QueryKey *qkey, SPIPlanPtr qplan, Relation fk_rel, Relation pk_rel, @@ -422,7 +421,7 @@ RI_FKey_check(TriggerData *trigdata) /* Prepare and save the plan */ qplan = ri_PlanCheck(querybuf.data, riinfo->nkeys, queryoids, - &qkey, fk_rel, pk_rel, true); + &qkey, fk_rel, pk_rel); } /* @@ -549,7 +548,7 @@ ri_Check_Pk_Match(Relation pk_rel, Relation fk_rel, /* Prepare and save the plan */ qplan = ri_PlanCheck(querybuf.data, riinfo->nkeys, queryoids, - &qkey, fk_rel, pk_rel, true); + &qkey, fk_rel, pk_rel); } /* @@ -741,7 +740,7 @@ ri_restrict(TriggerData *trigdata, bool is_no_action) /* Prepare and save the plan */ qplan = ri_PlanCheck(querybuf.data, riinfo->nkeys, queryoids, - &qkey, fk_rel, pk_rel, true); + &qkey, fk_rel, pk_rel); } /* @@ -846,7 +845,7 @@ RI_FKey_cascade_del(PG_FUNCTION_ARGS) /* Prepare and save the plan */ qplan = ri_PlanCheck(querybuf.data, riinfo->nkeys, queryoids, - &qkey, fk_rel, pk_rel, true); + &qkey, fk_rel, pk_rel); } /* @@ -968,7 +967,7 @@ RI_FKey_cascade_upd(PG_FUNCTION_ARGS) /* Prepare and save the plan */ qplan = ri_PlanCheck(querybuf.data, riinfo->nkeys * 2, queryoids, - &qkey, fk_rel, pk_rel, true); + &qkey, fk_rel, pk_rel); } /* @@ -1147,7 +1146,7 @@ ri_set(TriggerData *trigdata, bool is_set_null) /* Prepare and save the plan */ qplan = ri_PlanCheck(querybuf.data, riinfo->nkeys, queryoids, - &qkey, fk_rel, pk_rel, true); + &qkey, fk_rel, pk_rel); } /* @@ -2165,8 +2164,7 @@ InvalidateConstraintCacheCallBack(Datum arg, int cacheid, uint32 hashvalue) */ static SPIPlanPtr ri_PlanCheck(const char *querystr, int nargs, Oid *argtypes, - RI_QueryKey *qkey, Relation fk_rel, Relation pk_rel, - bool cache_plan) + RI_QueryKey *qkey, Relation fk_rel, Relation pk_rel) { SPIPlanPtr qplan; Relation query_rel; @@ -2197,12 +2195,9 @@ ri_PlanCheck(const char *querystr, int nargs, Oid *argtypes, /* Restore UID and security context */ SetUserIdAndSecContext(save_userid, save_sec_context); - /* Save the plan if requested */ - if (cache_plan) - { - SPI_keepplan(qplan); - ri_HashPreparedPlan(qkey, qplan); - } + /* Save the plan */ + SPI_keepplan(qplan); + ri_HashPreparedPlan(qkey, qplan); return qplan; } -- 2.23.0

view thread (3+ messages)  latest in thread

Message-ID: <ec8a8b45-a30b-9193-cd4b-985d60d1497e@2ndquadrant.com>
Permalink:  ../ec8a8b45-a30b-9193-cd4b-985d60d1497e@2ndquadrant.com/
Also on:    postgresql.org/message-id/ec8a8b45-a30b-9193-cd4b-985d60d1497e@2ndquadrant.com

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: peter.eisentraut@2ndquadrant.com
  Subject: Re: Remove unused function argument
  In-Reply-To: <ec8a8b45-a30b-9193-cd4b-985d60d1497e@2ndquadrant.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox