@@ -207,9 +207,10 @@ gistMakeUnionItVec(GISTSTATE *giststate, IndexTuple *itvec, int len, int startke
207207}
208208
209209/* Make union and store in attr array */
210- attr [i ]= FunctionCall2 (& giststate -> unionFn [i ],
211- PointerGetDatum (evec ),
212- PointerGetDatum (& attrsize ));
210+ attr [i ]= FunctionCall2Coll (& giststate -> unionFn [i ],
211+ giststate -> supportCollation [i ],
212+ PointerGetDatum (evec ),
213+ PointerGetDatum (& attrsize ));
213214
214215isnull [i ]= FALSE;
215216}
@@ -271,9 +272,10 @@ gistMakeUnionKey(GISTSTATE *giststate, int attno,
271272}
272273
273274* dstisnull = FALSE;
274- * dst = FunctionCall2 (& giststate -> unionFn [attno ],
275- PointerGetDatum (evec ),
276- PointerGetDatum (& dstsize ));
275+ * dst = FunctionCall2Coll (& giststate -> unionFn [attno ],
276+ giststate -> supportCollation [attno ],
277+ PointerGetDatum (evec ),
278+ PointerGetDatum (& dstsize ));
277279}
278280}
279281
@@ -282,9 +284,10 @@ gistKeyIsEQ(GISTSTATE *giststate, int attno, Datum a, Datum b)
282284{
283285bool result ;
284286
285- FunctionCall3 (& giststate -> equalFn [attno ],
286- a ,b ,
287- PointerGetDatum (& result ));
287+ FunctionCall3Coll (& giststate -> equalFn [attno ],
288+ giststate -> supportCollation [attno ],
289+ a ,b ,
290+ PointerGetDatum (& result ));
288291return result ;
289292}
290293
@@ -442,8 +445,9 @@ gistdentryinit(GISTSTATE *giststate, int nkey, GISTENTRY *e,
442445
443446gistentryinit (* e ,k ,r ,pg ,o ,l );
444447dep = (GISTENTRY * )
445- DatumGetPointer (FunctionCall1 (& giststate -> decompressFn [nkey ],
446- PointerGetDatum (e )));
448+ DatumGetPointer (FunctionCall1Coll (& giststate -> decompressFn [nkey ],
449+ giststate -> supportCollation [nkey ],
450+ PointerGetDatum (e )));
447451/* decompressFn may just return the given pointer */
448452if (dep != e )
449453gistentryinit (* e ,dep -> key ,dep -> rel ,dep -> page ,dep -> offset ,
@@ -468,8 +472,9 @@ gistcentryinit(GISTSTATE *giststate, int nkey,
468472
469473gistentryinit (* e ,k ,r ,pg ,o ,l );
470474cep = (GISTENTRY * )
471- DatumGetPointer (FunctionCall1 (& giststate -> compressFn [nkey ],
472- PointerGetDatum (e )));
475+ DatumGetPointer (FunctionCall1Coll (& giststate -> compressFn [nkey ],
476+ giststate -> supportCollation [nkey ],
477+ PointerGetDatum (e )));
473478/* compressFn may just return the given pointer */
474479if (cep != e )
475480gistentryinit (* e ,cep -> key ,cep -> rel ,cep -> page ,cep -> offset ,
@@ -519,11 +524,13 @@ gistpenalty(GISTSTATE *giststate, int attno,
519524{
520525float penalty = 0.0 ;
521526
522- if (giststate -> penaltyFn [attno ].fn_strict == FALSE|| (isNullOrig == FALSE&& isNullAdd == FALSE))
523- FunctionCall3 (& giststate -> penaltyFn [attno ],
524- PointerGetDatum (orig ),
525- PointerGetDatum (add ),
526- PointerGetDatum (& penalty ));
527+ if (giststate -> penaltyFn [attno ].fn_strict == FALSE||
528+ (isNullOrig == FALSE&& isNullAdd == FALSE))
529+ FunctionCall3Coll (& giststate -> penaltyFn [attno ],
530+ giststate -> supportCollation [attno ],
531+ PointerGetDatum (orig ),
532+ PointerGetDatum (add ),
533+ PointerGetDatum (& penalty ));
527534else if (isNullOrig && isNullAdd )
528535penalty = 0.0 ;
529536else