1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-11 10:01:57 +03:00

Clean up handling of tuple descriptors so that result-tuple descriptors

allocated by plan nodes are not leaked at end of query.  This doesn't
really matter for normal queries, but it sure does for queries invoked
repetitively inside SQL functions.  Clean up some other grotty code
associated with tupdescs, and fix a few other memory leaks exposed by
tests with simple SQL functions.
This commit is contained in:
Tom Lane
2001-01-29 00:39:20 +00:00
parent 51cd037746
commit 0d54d6ac44
25 changed files with 423 additions and 748 deletions

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: execnodes.h,v 1.55 2001/01/24 19:43:25 momjian Exp $
* $Id: execnodes.h,v 1.56 2001/01/29 00:39:20 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -164,11 +164,19 @@ typedef struct ProjectionInfo
* (including the junk attributes).
* cleanTargetList: the "clean" target list (junk attributes removed).
* cleanLength: the length of 'cleanTargetList'
* cleanTupTyp: the tuple descriptor of the "clean" tuple (with
* cleanTupType: the tuple descriptor of the "clean" tuple (with
* junk attributes removed).
* cleanMap: A map with the correspondance between the non junk
* cleanMap: A map with the correspondance between the non-junk
* attributes of the "original" tuple and the
* attributes of the "clean" tuple.
* junkContext: memory context holding the JunkFilter node and all
* its subsidiary data structures.
*
* NOTE: the original targetList and tupType are passed to ExecInitJunkFilter
* and do not belong to the JunkFilter. All the other subsidiary structures
* are created during ExecInitJunkFilter, and all of them can be freed by
* deleting the memory context junkContext. This would not be needed if we
* had a cleaner approach to managing query-lifetime data structures...
* ----------------
*/
typedef struct JunkFilter
@ -181,6 +189,7 @@ typedef struct JunkFilter
int jf_cleanLength;
TupleDesc jf_cleanTupType;
AttrNumber *jf_cleanMap;
MemoryContext jf_junkContext;
} JunkFilter;
/* ----------------