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:
@ -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;
|
||||
|
||||
/* ----------------
|
||||
|
Reference in New Issue
Block a user