aboutsummaryrefslogtreecommitdiff
path: root/contrib/intarray/_intbig_gist.c
diff options
context:
space:
mode:
authorTeodor Sigaev <teodor@sigaev.ru>2006-04-03 09:35:35 +0000
committerTeodor Sigaev <teodor@sigaev.ru>2006-04-03 09:35:35 +0000
commit06e44788774db29fc7efe8084fc34c3c79235761 (patch)
tree239bbe20ecd8d5a97475be66b3cbcd3b8f2df05d /contrib/intarray/_intbig_gist.c
parente88d84b7370cf2191dc178309f356cfebb48a5d0 (diff)
downloadpostgresql-06e44788774db29fc7efe8084fc34c3c79235761.tar.gz
postgresql-06e44788774db29fc7efe8084fc34c3c79235761.zip
Detoast query in g_intbig_consistent and copy query in g_int_consistent.
Minor cleanups.
Diffstat (limited to 'contrib/intarray/_intbig_gist.c')
-rw-r--r--contrib/intarray/_intbig_gist.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/contrib/intarray/_intbig_gist.c b/contrib/intarray/_intbig_gist.c
index c49a2aab534..0c7f90ddd13 100644
--- a/contrib/intarray/_intbig_gist.c
+++ b/contrib/intarray/_intbig_gist.c
@@ -486,7 +486,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;
@@ -495,14 +495,17 @@ 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);
+ PG_RETURN_BOOL(retval);
}
- /* XXX what about toasted input? */
- if (ARRISVOID(query))
- return FALSE;
+ if (ARRISVOID(query)) {
+ PG_FREE_IF_COPY(query, 1);
+ PG_RETURN_BOOL(FALSE);
+ }
switch (strategy)
{