@@ -209,8 +209,7 @@ static const RI_ConstraintInfo *ri_FetchConstraintInfo(Trigger *trigger,
209209 Relation trig_rel , bool rel_is_pk );
210210static const RI_ConstraintInfo * ri_LoadConstraintInfo (Oid constraintOid );
211211static SPIPlanPtr ri_PlanCheck (const char * querystr , int nargs , Oid * argtypes ,
212- RI_QueryKey * qkey , Relation fk_rel , Relation pk_rel ,
213- bool cache_plan );
212+ RI_QueryKey * qkey , Relation fk_rel , Relation pk_rel );
214213static bool ri_PerformCheck (const RI_ConstraintInfo * riinfo ,
215214 RI_QueryKey * qkey , SPIPlanPtr qplan ,
216215 Relation fk_rel , Relation pk_rel ,
@@ -385,7 +384,7 @@ RI_FKey_check(TriggerData *trigdata)
385384
386385 /* Prepare and save the plan */
387386 qplan = ri_PlanCheck (querybuf .data , riinfo -> nkeys , queryoids ,
388- & qkey , fk_rel , pk_rel , true );
387+ & qkey , fk_rel , pk_rel );
389388 }
390389
391390 /*
@@ -512,7 +511,7 @@ ri_Check_Pk_Match(Relation pk_rel, Relation fk_rel,
512511
513512 /* Prepare and save the plan */
514513 qplan = ri_PlanCheck (querybuf .data , riinfo -> nkeys , queryoids ,
515- & qkey , fk_rel , pk_rel , true );
514+ & qkey , fk_rel , pk_rel );
516515 }
517516
518517 /*
@@ -704,7 +703,7 @@ ri_restrict(TriggerData *trigdata, bool is_no_action)
704703
705704 /* Prepare and save the plan */
706705 qplan = ri_PlanCheck (querybuf .data , riinfo -> nkeys , queryoids ,
707- & qkey , fk_rel , pk_rel , true );
706+ & qkey , fk_rel , pk_rel );
708707 }
709708
710709 /*
@@ -809,7 +808,7 @@ RI_FKey_cascade_del(PG_FUNCTION_ARGS)
809808
810809 /* Prepare and save the plan */
811810 qplan = ri_PlanCheck (querybuf .data , riinfo -> nkeys , queryoids ,
812- & qkey , fk_rel , pk_rel , true );
811+ & qkey , fk_rel , pk_rel );
813812 }
814813
815814 /*
@@ -931,7 +930,7 @@ RI_FKey_cascade_upd(PG_FUNCTION_ARGS)
931930
932931 /* Prepare and save the plan */
933932 qplan = ri_PlanCheck (querybuf .data , riinfo -> nkeys * 2 , queryoids ,
934- & qkey , fk_rel , pk_rel , true );
933+ & qkey , fk_rel , pk_rel );
935934 }
936935
937936 /*
@@ -1110,7 +1109,7 @@ ri_set(TriggerData *trigdata, bool is_set_null)
11101109
11111110 /* Prepare and save the plan */
11121111 qplan = ri_PlanCheck (querybuf .data , riinfo -> nkeys , queryoids ,
1113- & qkey , fk_rel , pk_rel , true );
1112+ & qkey , fk_rel , pk_rel );
11141113 }
11151114
11161115 /*
@@ -2128,8 +2127,7 @@ InvalidateConstraintCacheCallBack(Datum arg, int cacheid, uint32 hashvalue)
21282127 */
21292128static SPIPlanPtr
21302129ri_PlanCheck (const char * querystr , int nargs , Oid * argtypes ,
2131- RI_QueryKey * qkey , Relation fk_rel , Relation pk_rel ,
2132- bool cache_plan )
2130+ RI_QueryKey * qkey , Relation fk_rel , Relation pk_rel )
21332131{
21342132 SPIPlanPtr qplan ;
21352133 Relation query_rel ;
@@ -2160,12 +2158,9 @@ ri_PlanCheck(const char *querystr, int nargs, Oid *argtypes,
21602158 /* Restore UID and security context */
21612159 SetUserIdAndSecContext (save_userid , save_sec_context );
21622160
2163- /* Save the plan if requested */
2164- if (cache_plan )
2165- {
2166- SPI_keepplan (qplan );
2167- ri_HashPreparedPlan (qkey , qplan );
2168- }
2161+ /* Save the plan */
2162+ SPI_keepplan (qplan );
2163+ ri_HashPreparedPlan (qkey , qplan );
21692164
21702165 return qplan ;
21712166}
0 commit comments