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/commands/copy.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/backend/commands/copy.c') diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c index c71d0818098..4b81a35c122 100644 --- a/src/backend/commands/copy.c +++ b/src/backend/commands/copy.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.120 2000/08/06 04:26:40 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.121 2000/08/22 04:06:21 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -29,6 +29,7 @@ #include "executor/executor.h" #include "libpq/libpq.h" #include "miscadmin.h" +#include "tcop/pquery.h" #include "tcop/tcopprot.h" #include "utils/acl.h" #include "utils/builtins.h" @@ -598,7 +599,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, tuples_read = 0; bool reading_to_eof = true; RelationInfo *relationInfo; - EState *estate = makeNode(EState); /* for ExecConstraints() */ + EState *estate = CreateExecutorState(); /* for ExecConstraints() */ TupleTable tupleTable; TupleTableSlot *slot; Oid loaded_oid = InvalidOid; -- cgit v1.2.3