diff options
author | Teodor Sigaev <teodor@sigaev.ru> | 2006-04-03 08:21:05 +0000 |
---|---|---|
committer | Teodor Sigaev <teodor@sigaev.ru> | 2006-04-03 08:21:05 +0000 |
commit | 7f129956e16e74460fc47dd89c174ca232bfd1b6 (patch) | |
tree | 3bc9f49e33731c086f903e81b666ab55a0837850 /contrib/intarray/_intbig_gist.c | |
parent | ef524d17751cbb0b373f47f1c45f7fc07c4786f0 (diff) | |
download | postgresql-7f129956e16e74460fc47dd89c174ca232bfd1b6.tar.gz postgresql-7f129956e16e74460fc47dd89c174ca232bfd1b6.zip |
Detoast query in g_intbig_consistent and copy query in g_int_consistent
Diffstat (limited to 'contrib/intarray/_intbig_gist.c')
-rw-r--r-- | contrib/intarray/_intbig_gist.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/contrib/intarray/_intbig_gist.c b/contrib/intarray/_intbig_gist.c index 844236068db..caa0ad48c60 100644 --- a/contrib/intarray/_intbig_gist.c +++ b/contrib/intarray/_intbig_gist.c @@ -497,7 +497,7 @@ Datum g_intbig_consistent(PG_FUNCTION_ARGS) { GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); - ArrayType *query = (ArrayType *) PG_GETARG_POINTER(1); + ArrayType *query = (ArrayType *) PG_DETOAST_DATUM(PG_GETARG_POINTER(1)); StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); bool retval; @@ -506,12 +506,13 @@ g_intbig_consistent(PG_FUNCTION_ARGS) if (strategy == BooleanSearchStrategy) { - PG_RETURN_BOOL(signconsistent((QUERYTYPE *) query, + retval =signconsistent((QUERYTYPE *) query, GETSIGN(DatumGetPointer(entry->key)), - false)); + false); + PG_FREE_IF_COPY( query, 1 ); + return retval; } - /* XXX what about toasted input? */ CHECKARRVALID(query); if (ARRISVOID(query)) return FALSE; @@ -597,5 +598,6 @@ g_intbig_consistent(PG_FUNCTION_ARGS) default: retval = FALSE; } + PG_FREE_IF_COPY( query, 1 ); PG_RETURN_BOOL(retval); } |