X-Git-Url: http://sigaev.ru/git/gitweb.cgi?p=smlar.git;a=blobdiff_plain;f=smlar_gist.c;h=7d77788af34dc23332ad163c0584c36c0c4c3c8a;hp=382b9328114b9f7b77d13ed682bf36594006fe14;hb=HEAD;hpb=8d02df18c0bbfd6ccba94a9582499ec8746047e5 diff --git a/smlar_gist.c b/smlar_gist.c index 382b932..480d744 100644 --- a/smlar_gist.c +++ b/smlar_gist.c @@ -3,7 +3,11 @@ #include "fmgr.h" #include "access/gist.h" #include "access/skey.h" +#if PG_VERSION_NUM < 130000 #include "access/tuptoaster.h" +#else +#include "access/heaptoast.h" +#endif #include "utils/memutils.h" typedef struct SmlSign { @@ -164,7 +168,9 @@ Array2HashedArray(ProcTypeInfo info, ArrayType *a) ptr = GETARR(sign); for(i=0;inelems;i++) - ptr[i] = DatumGetUInt32( FunctionCall1( &s->info->hashFunc, s->elems[i] ) ); + ptr[i] = DatumGetUInt32(FunctionCall1Coll(&s->info->hashFunc, + DEFAULT_COLLATION_OID, + s->elems[i])); /* * there is a collision of hash-function; len is always equal or less than @@ -239,8 +245,13 @@ getHashedCache(void *cache) getFmgrInfoHash(stat->info); for(i=0;inelems;i++) { - uint32 hash = DatumGetUInt32( FunctionCall1( &stat->info->hashFunc, stat->elems[i].datum ) ); - int index = HASHVAL(hash); + uint32 hash; + int index; + + hash = DatumGetUInt32(FunctionCall1Coll(&stat->info->hashFunc, + DEFAULT_COLLATION_OID, + stat->elems[i].datum)); + index = HASHVAL(hash); stat->helems[i].hash = hash; stat->helems[i].idfMin = stat->helems[i].idfMax = stat->elems[i].idf; @@ -296,7 +307,9 @@ fillHashVal(void *cache, SimpleArray *a) getFmgrInfoHash(a->info); for(i=0;inelems;i++) - a->hash[i] = DatumGetUInt32( FunctionCall1( &a->info->hashFunc, a->elems[i] ) ); + a->hash[i] = DatumGetUInt32(FunctionCall1Coll(&a->info->hashFunc, + DEFAULT_COLLATION_OID, + a->elems[i])); } @@ -380,7 +393,7 @@ gsmlsign_compress(PG_FUNCTION_ARGS) retval = (GISTENTRY *) palloc(sizeof(GISTENTRY)); gistentryinit(*retval, PointerGetDatum(sign), entry->rel, entry->page, - entry->offset, FALSE); + entry->offset, false); } else if ( ISSIGNKEY(DatumGetPointer(entry->key)) && !ISALLTRUE(DatumGetPointer(entry->key)) ) @@ -404,7 +417,7 @@ gsmlsign_compress(PG_FUNCTION_ARGS) gistentryinit(*retval, PointerGetDatum(sign), entry->rel, entry->page, - entry->offset, FALSE); + entry->offset, false); } } @@ -425,7 +438,7 @@ gsmlsign_decompress(PG_FUNCTION_ARGS) gistentryinit(*retval, PointerGetDatum(key), entry->rel, entry->page, - entry->offset, FALSE); + entry->offset, false); PG_RETURN_POINTER(retval); }