From 0147b1934f251183d3614bca011bf21205890835 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 22 Aug 2000 04:06:22 +0000 Subject: Fix a many-legged critter reported by chifungfan@yahoo.com: under the right circumstances a hash join executed as a DECLARE CURSOR/FETCH query would crash the backend. Problem as seen in current sources was that the hash tables were stored in a context that was a child of TransactionCommandContext, which got zapped at completion of the FETCH command --- but cursor cleanup executed at COMMIT expected the tables to still be valid. I haven't chased down the details as seen in 7.0.* but I'm sure it's the same general problem. --- src/backend/executor/nodeHash.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/backend/executor/nodeHash.c') diff --git a/src/backend/executor/nodeHash.c b/src/backend/executor/nodeHash.c index f63ffe49435..682afdba4af 100644 --- a/src/backend/executor/nodeHash.c +++ b/src/backend/executor/nodeHash.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * - * $Id: nodeHash.c,v 1.50 2000/07/17 03:04:53 tgl Exp $ + * $Id: nodeHash.c,v 1.51 2000/08/22 04:06:19 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -334,7 +334,8 @@ ExecHashTableCreate(Hash *node) /* ---------------- * Initialize the hash table control block. - * The hashtable control block is just palloc'd from executor memory. + * The hashtable control block is just palloc'd from the executor's + * per-query memory context. * ---------------- */ hashtable = (HashJoinTable) palloc(sizeof(HashTableData)); @@ -361,7 +362,7 @@ ExecHashTableCreate(Hash *node) * working storage. See notes in executor/hashjoin.h. * ---------------- */ - hashtable->hashCxt = AllocSetContextCreate(TransactionCommandContext, + hashtable->hashCxt = AllocSetContextCreate(CurrentMemoryContext, "HashTableContext", ALLOCSET_DEFAULT_MINSIZE, ALLOCSET_DEFAULT_INITSIZE, -- cgit v1.2.3