pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Remove unused function argument
3+ messages / 2 participants
[nested] [flat]

Commits from this thread:
  2019-11-06 5b7ba75f7f  Remove unused function argument
* Remove unused function argument
@ 2019-10-29 09:21 Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  2019-10-30 05:51 ` Re: Remove unused function argument vignesh C <vignesh21@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Peter Eisentraut @ 2019-10-29 09:21 UTC (permalink / raw)
  To: pgsql-hackers

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
^ permalink raw reply [nested|flat] 3+ messages in thread

* Re: Remove unused function argument
  2019-10-29 09:21 Remove unused function argument Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
@ 2019-10-30 05:51 ` vignesh C <vignesh21@gmail.com>
  2019-11-06 07:20   ` Re: Remove unused function argument Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  0 siblings, 1 reply; 3+ messages in thread

From: vignesh C @ 2019-10-30 05:51 UTC (permalink / raw)
  To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; +Cc: pgsql-hackers

On Tue, Oct 29, 2019 at 2:51 PM Peter Eisentraut
<peter.eisentraut@2ndquadrant.com> wrote:
>
> 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.
>
Code changes looks fine to me.

Regards,
Vignesh
EnterpriseDB: http://www.enterprisedb.com





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Remove unused function argument
  2019-10-29 09:21 Remove unused function argument Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  2019-10-30 05:51 ` Re: Remove unused function argument vignesh C <vignesh21@gmail.com>
@ 2019-11-06 07:20   ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Peter Eisentraut @ 2019-11-06 07:20 UTC (permalink / raw)
  To: vignesh C <vignesh21@gmail.com>; +Cc: pgsql-hackers

On 2019-10-30 06:51, vignesh C wrote:
> On Tue, Oct 29, 2019 at 2:51 PM Peter Eisentraut
> <peter.eisentraut@2ndquadrant.com> wrote:
>>
>> 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.
>>
> Code changes looks fine to me.

pushed, thanks


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





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2019-11-06 07:20 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-10-29 09:21 Remove unused function argument Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
2019-10-30 05:51 ` vignesh C <vignesh21@gmail.com>
2019-11-06 07:20   ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>

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