1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

When using a junkfilter, the output tuple should NOT be stored back into

the same tuple slot that the raw tuple came from, because that slot has
the wrong tuple descriptor.  Store it into its own slot with the correct
descriptor, instead.  This repairs problems with SPI functions seeing
inappropriate tuple descriptors --- for example, plpgsql code failing to
cope with SELECT FOR UPDATE.
This commit is contained in:
Tom Lane
2001-05-27 20:48:51 +00:00
parent a3855c5761
commit 9e7243063c
4 changed files with 50 additions and 23 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.59 2001/05/15 00:33:36 tgl Exp $
* $Id: execnodes.h,v 1.60 2001/05/27 20:48:51 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -166,17 +166,19 @@ typedef struct ProjectionInfo
* cleanLength: the length of 'cleanTargetList'
* cleanTupType: the tuple descriptor of the "clean" tuple (with
* junk attributes removed).
* cleanMap: A map with the correspondance between the non-junk
* attributes of the "original" tuple and the
* attributes of the "clean" tuple.
* cleanMap: A map with the correspondence between the non-junk
* attribute numbers of the "original" tuple and the
* attribute numbers of the "clean" tuple.
* junkContext: memory context holding the JunkFilter node and all
* its subsidiary data structures.
* resultSlot: tuple slot that can be used to hold cleaned tuple.
*
* 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...
* NOTE: the original targetList and tupType are passed to ExecInitJunkFilter,
* as is the resultSlot. These items 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
@ -190,6 +192,7 @@ typedef struct JunkFilter
TupleDesc jf_cleanTupType;
AttrNumber *jf_cleanMap;
MemoryContext jf_junkContext;
TupleTableSlot *jf_resultSlot;
} JunkFilter;
/* ----------------