Remove unused function argument
authorPeter Eisentraut <peter@eisentraut.org>
Wed, 6 Nov 2019 07:07:04 +0000 (08:07 +0100)
committerPeter Eisentraut <peter@eisentraut.org>
Wed, 6 Nov 2019 07:19:27 +0000 (08:19 +0100)
The cache_plan argument to ri_PlanCheck has not been used since
e8c9fd5fdf768323911f7088e8287f63b513c3c6.

Reviewed-by: vignesh C <vignesh21@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/ec8a8b45-a30b-9193-cd4b-985d60d1497e%402ndquadrant.com

src/backend/utils/adt/ri_triggers.c

index fb477d4fa017accc90d48b2b390c9fb09f004bf1..caf27f8bcb44dc84a6d093378751e7f324b31b27 100644 (file)
@@ -209,8 +209,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,
@@ -385,7 +384,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);
    }
 
    /*
@@ -512,7 +511,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);
    }
 
    /*
@@ -704,7 +703,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);
    }
 
    /*
@@ -809,7 +808,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);
    }
 
    /*
@@ -931,7 +930,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);
    }
 
    /*
@@ -1110,7 +1109,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);
    }
 
    /*
@@ -2128,8 +2127,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;
@@ -2160,12 +2158,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;
 }