*** postgresql-7.1.1/src/backend/access/gist/gist.c.orig Tue May 15 12:31:01 2001 --- postgresql-7.1.1/src/backend/access/gist/gist.c Tue May 15 12:55:20 2001 *************** *** 1199,1211 **** gistentryinit(*e, pr, r, pg, o, b, l); if (giststate->haskeytype) { ! dep = (GISTENTRY *) ! DatumGetPointer(FunctionCall1(&giststate->decompressFn, PointerGetDatum(e))); ! gistentryinit(*e, dep->pred, dep->rel, dep->page, dep->offset, dep->bytes, dep->leafkey); ! if (dep != e) ! pfree(dep); } } --- 1199,1215 ---- gistentryinit(*e, pr, r, pg, o, b, l); if (giststate->haskeytype) { ! if ( b ) { ! dep = (GISTENTRY *) ! DatumGetPointer(FunctionCall1(&giststate->decompressFn, PointerGetDatum(e))); ! gistentryinit(*e, dep->pred, dep->rel, dep->page, dep->offset, dep->bytes, dep->leafkey); ! if (dep != e) ! pfree(dep); ! } else { ! gistentryinit(*e, (char*)NULL, r, pg, o, 0, l); ! } } } *** postgresql-7.1.1/src/backend/access/gist/gistget.c.orig Mon May 14 18:55:31 2001 --- postgresql-7.1.1/src/backend/access/gist/gistget.c Mon May 14 19:12:08 2001 *************** *** 241,256 **** 1, tupdesc, &isNull); ! gistdentryinit(giststate, &de, (char *) datum, r, p, offset, ! IndexTupleSize(tuple) - sizeof(IndexTupleData), ! FALSE); ! ! if (isNull) { /* XXX eventually should check if SK_ISNULL */ return false; } if (key[0].sk_flags & SK_COMMUTE) { test = FunctionCall3(&key[0].sk_func, --- 241,256 ---- 1, tupdesc, &isNull); ! if (isNull || IndexTupleSize(tuple) == sizeof(IndexTupleData) ) { /* XXX eventually should check if SK_ISNULL */ return false; } + gistdentryinit(giststate, &de, (char *) datum, r, p, offset, + IndexTupleSize(tuple) - sizeof(IndexTupleData), + FALSE); + if (key[0].sk_flags & SK_COMMUTE) { test = FunctionCall3(&key[0].sk_func, *************** *** 265,270 **** --- 265,273 ---- key[0].sk_argument, ObjectIdGetDatum(key[0].sk_procedure)); } + + if ( (char*)de.pred != (char*)datum ) + if ( de.pred ) pfree( de.pred ); if (DatumGetBool(test) == !!(key[0].sk_flags & SK_NEGATE)) return false;