aboutsummaryrefslogtreecommitdiff
path: root/contrib/intarray/_int_gist.c
diff options
context:
space:
mode:
authorTeodor Sigaev <teodor@sigaev.ru>2006-04-03 08:21:05 +0000
committerTeodor Sigaev <teodor@sigaev.ru>2006-04-03 08:21:05 +0000
commit7f129956e16e74460fc47dd89c174ca232bfd1b6 (patch)
tree3bc9f49e33731c086f903e81b666ab55a0837850 /contrib/intarray/_int_gist.c
parentef524d17751cbb0b373f47f1c45f7fc07c4786f0 (diff)
downloadpostgresql-7f129956e16e74460fc47dd89c174ca232bfd1b6.tar.gz
postgresql-7f129956e16e74460fc47dd89c174ca232bfd1b6.zip
Detoast query in g_intbig_consistent and copy query in g_int_consistent
Diffstat (limited to 'contrib/intarray/_int_gist.c')
-rw-r--r--contrib/intarray/_int_gist.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/contrib/intarray/_int_gist.c b/contrib/intarray/_int_gist.c
index 246d5669873..e8cf24fe47b 100644
--- a/contrib/intarray/_int_gist.c
+++ b/contrib/intarray/_int_gist.c
@@ -32,17 +32,19 @@ Datum
g_int_consistent(PG_FUNCTION_ARGS)
{
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
- ArrayType *query = (ArrayType *) PG_GETARG_POINTER(1);
+ ArrayType *query = (ArrayType *) PG_DETOAST_DATUM_COPY(PG_GETARG_POINTER(1));
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
bool retval;
- if (strategy == BooleanSearchStrategy)
- PG_RETURN_BOOL(execconsistent((QUERYTYPE *) query,
+ if (strategy == BooleanSearchStrategy) {
+ retval = execconsistent((QUERYTYPE *) query,
(ArrayType *) DatumGetPointer(entry->key),
- GIST_LEAF(entry)));
+ GIST_LEAF(entry));
+
+ pfree( query );
+ PG_RETURN_BOOL(retval);
+ }
- /* XXX are we sure it's safe to scribble on the query object here? */
- /* XXX what about toasted input? */
/* sort query for fast search, key is already sorted */
CHECKARRVALID(query);
if (ARRISVOID(query))
@@ -82,6 +84,7 @@ g_int_consistent(PG_FUNCTION_ARGS)
default:
retval = FALSE;
}
+ pfree( query );
PG_RETURN_BOOL(retval);
}