aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/gin/ginutil.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2011-04-22 20:13:12 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2011-04-22 20:13:12 -0400
commitae20bf1740c53494e15fadfd8c2c6444032a3441 (patch)
treeacbc7796d38c411fa5e23b3693be15e9aab7e664 /src/backend/access/gin/ginutil.c
parent474ff212e5c2e89a9955cc2355cb96b2fe40398e (diff)
downloadpostgresql-ae20bf1740c53494e15fadfd8c2c6444032a3441.tar.gz
postgresql-ae20bf1740c53494e15fadfd8c2c6444032a3441.zip
Make GIN and GIST pass the index collation to all their support functions.
Experimentation with contrib/btree_gist shows that the majority of the GIST support functions potentially need collation information. Safest policy seems to be to pass it to all of them, instead of making assumptions about which ones could possibly need it.
Diffstat (limited to 'src/backend/access/gin/ginutil.c')
-rw-r--r--src/backend/access/gin/ginutil.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/backend/access/gin/ginutil.c b/src/backend/access/gin/ginutil.c
index a712331cf47..1ae51b10602 100644
--- a/src/backend/access/gin/ginutil.c
+++ b/src/backend/access/gin/ginutil.c
@@ -93,17 +93,17 @@ initGinState(GinState *state, Relation index)
* while doing comparisons. However, we may have a collatable storage
* type for a noncollatable indexed data type (for instance, hstore
* uses text index entries). If there's no index collation then
- * specify default collation in case the comparison function needs
- * collation. This is harmless if the comparison function doesn't
+ * specify default collation in case the support functions need
+ * collation. This is harmless if the support functions don't
* care about collation, so we just do it unconditionally. (We could
* alternatively call get_typcollation, but that seems like expensive
* overkill --- there aren't going to be any cases where a GIN storage
* type has a nondefault collation.)
*/
if (OidIsValid(index->rd_indcollation[i]))
- state->compareCollation[i] = index->rd_indcollation[i];
+ state->supportCollation[i] = index->rd_indcollation[i];
else
- state->compareCollation[i] = DEFAULT_COLLATION_OID;
+ state->supportCollation[i] = DEFAULT_COLLATION_OID;
}
}
@@ -293,7 +293,7 @@ ginCompareEntries(GinState *ginstate, OffsetNumber attnum,
/* both not null, so safe to call the compareFn */
return DatumGetInt32(FunctionCall2Coll(&ginstate->compareFn[attnum - 1],
- ginstate->compareCollation[attnum - 1],
+ ginstate->supportCollation[attnum - 1],
a, b));
}
@@ -399,10 +399,11 @@ ginExtractEntries(GinState *ginstate, OffsetNumber attnum,
/* OK, call the opclass's extractValueFn */
nullFlags = NULL; /* in case extractValue doesn't set it */
entries = (Datum *)
- DatumGetPointer(FunctionCall3(&ginstate->extractValueFn[attnum - 1],
- value,
- PointerGetDatum(nentries),
- PointerGetDatum(&nullFlags)));
+ DatumGetPointer(FunctionCall3Coll(&ginstate->extractValueFn[attnum - 1],
+ ginstate->supportCollation[attnum - 1],
+ value,
+ PointerGetDatum(nentries),
+ PointerGetDatum(&nullFlags)));
/*
* Generate a placeholder if the item contained no keys.
@@ -453,7 +454,7 @@ ginExtractEntries(GinState *ginstate, OffsetNumber attnum,
}
arg.cmpDatumFunc = &ginstate->compareFn[attnum - 1];
- arg.collation = ginstate->compareCollation[attnum - 1];
+ arg.collation = ginstate->supportCollation[attnum - 1];
arg.haveDups = false;
qsort_arg(keydata, *nentries, sizeof(keyEntryData),
cmpEntries, (void *) &arg);