so->tempCxt = AllocSetContextCreate(CurrentMemoryContext,
"SP-GiST search temporary context",
ALLOCSET_DEFAULT_SIZES);
+ so->traversalCxt = AllocSetContextCreate(CurrentMemoryContext,
+ "SP-GiST traversal-value context",
+ ALLOCSET_DEFAULT_SIZES);
/* Set up indexTupDesc and xs_itupdesc in case it's an index-only scan */
so->indexTupDesc = scan->xs_itupdesc = RelationGetDescr(rel);
{
SpGistScanOpaque so = (SpGistScanOpaque) scan->opaque;
+ /* clear traversal context before proceeding to the next scan */
+ MemoryContextReset(so->traversalCxt);
+
/* copy scankeys into local storage */
if (scankey && scan->numberOfKeys > 0)
{
SpGistScanOpaque so = (SpGistScanOpaque) scan->opaque;
MemoryContextDelete(so->tempCxt);
+ MemoryContextDelete(so->traversalCxt);
}
/*
in.scankeys = so->keyData;
in.nkeys = so->numberOfKeys;
in.reconstructedValue = stackEntry->reconstructedValue;
- in.traversalMemoryContext = oldCtx;
+ in.traversalMemoryContext = so->traversalCxt;
in.traversalValue = stackEntry->traversalValue;
in.level = stackEntry->level;
in.returnData = so->want_itup;
{
SpGistState state; /* see above */
MemoryContext tempCxt; /* short-lived memory context */
+ MemoryContext traversalCxt; /* memory context for traversalValues */
/* Control flags showing whether to search nulls and/or non-nulls */
bool searchNulls; /* scan matches (all) null entries */