1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-03 20:02:46 +03:00

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.
This commit is contained in:
Tom Lane
2000-08-22 04:06:22 +00:00
parent 94e90d9a86
commit 0147b1934f
7 changed files with 84 additions and 51 deletions

View File

@ -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,