From 2c33f1bb9c363cbb34767ecc37c463e1162372ee Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Sat, 5 Mar 2011 18:30:04 +0100
Subject: [PATCH] Attach collation information to several FmgrInfo structs in selfuncs.c

---
 src/backend/utils/adt/selfuncs.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c
index f10110b..783ad7c 100644
*** a/src/backend/utils/adt/selfuncs.c
--- b/src/backend/utils/adt/selfuncs.c
*************** var_eq_const(VariableStatData *vardata,
*** 285,290 ****
--- 285,291 ----
  			FmgrInfo	eqproc;
  
  			fmgr_info(get_opcode(operator), &eqproc);
+ 			fmgr_info_collation(DEFAULT_COLLATION_OID, &eqproc);
  
  			for (i = 0; i < nvalues; i++)
  			{
*************** eqjoinsel_inner(Oid operator,
*** 2116,2121 ****
--- 2117,2123 ----
  					nmatches;
  
  		fmgr_info(get_opcode(operator), &eqproc);
+ 		fmgr_info_collation(DEFAULT_COLLATION_OID, &eqproc);
  		hasmatch1 = (bool *) palloc0(nvalues1 * sizeof(bool));
  		hasmatch2 = (bool *) palloc0(nvalues2 * sizeof(bool));
  
*************** eqjoinsel_semi(Oid operator,
*** 2338,2343 ****
--- 2340,2346 ----
  					nmatches;
  
  		fmgr_info(get_opcode(operator), &eqproc);
+ 		fmgr_info_collation(DEFAULT_COLLATION_OID, &eqproc);
  		hasmatch1 = (bool *) palloc0(nvalues1 * sizeof(bool));
  		hasmatch2 = (bool *) palloc0(nvalues2 * sizeof(bool));
  
*************** prefix_selectivity(PlannerInfo *root, Va
*** 5108,5115 ****
  								 BTGreaterEqualStrategyNumber);
  	if (cmpopr == InvalidOid)
  		elog(ERROR, "no >= operator for opfamily %u", opfamily);
- 	fmgr_info(get_opcode(cmpopr), &opproc);
  
  	prefixsel = ineq_histogram_selectivity(root, vardata, &opproc, true,
  										   prefixcon->constvalue,
  										   prefixcon->consttype);
--- 5111,5119 ----
  								 BTGreaterEqualStrategyNumber);
  	if (cmpopr == InvalidOid)
  		elog(ERROR, "no >= operator for opfamily %u", opfamily);
  
+ 	fmgr_info(get_opcode(cmpopr), &opproc);
+ 	fmgr_info_collation(DEFAULT_COLLATION_OID, &opproc);
  	prefixsel = ineq_histogram_selectivity(root, vardata, &opproc, true,
  										   prefixcon->constvalue,
  										   prefixcon->consttype);
*************** prefix_selectivity(PlannerInfo *root, Va
*** 5130,5135 ****
--- 5134,5140 ----
  	if (cmpopr == InvalidOid)
  		elog(ERROR, "no < operator for opfamily %u", opfamily);
  	fmgr_info(get_opcode(cmpopr), &opproc);
+ 	fmgr_info_collation(DEFAULT_COLLATION_OID, &opproc);
  
  	greaterstrcon = make_greater_string(prefixcon, &opproc);
  	if (greaterstrcon)
-- 
1.7.1

