mirror of
https://github.com/postgres/postgres.git
synced 2025-07-07 00:36:50 +03:00
Fix problems with SQL functions returning rowtypes that have dropped
columns. The returned tuple needs to have appropriate NULL columns inserted so that it actually matches the declared rowtype. It seemed convenient to use a JunkFilter for this, so I made some cleanups and simplifications in the JunkFilter code to allow it to support this additional functionality. (That in turn exposed a latent bug in nodeAppend.c, which is that it was returning a tuple slot whose descriptor didn't match its data.) Also, move check_sql_fn_retval out of pg_proc.c and into functions.c, where it seems to more naturally belong.
This commit is contained in:
@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/nodes/execnodes.h,v 1.119 2004/08/29 05:06:57 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/include/nodes/execnodes.h,v 1.120 2004/10/07 18:38:51 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -209,7 +209,7 @@ typedef struct ProjectionInfo
|
||||
* This class is used to store information regarding junk attributes.
|
||||
* A junk attribute is an attribute in a tuple that is needed only for
|
||||
* storing intermediate information in the executor, and does not belong
|
||||
* in emitted tuples. For example, when we do an UPDATE query,
|
||||
* in emitted tuples. For example, when we do an UPDATE query,
|
||||
* the planner adds a "junk" entry to the targetlist so that the tuples
|
||||
* returned to ExecutePlan() contain an extra attribute: the ctid of
|
||||
* the tuple to be updated. This is needed to do the update, but we
|
||||
@ -218,12 +218,7 @@ typedef struct ProjectionInfo
|
||||
* real output tuple.
|
||||
*
|
||||
* targetList: the original target list (including junk attributes).
|
||||
* length: the length of 'targetList'.
|
||||
* tupType: the tuple descriptor for the "original" tuple
|
||||
* (including the junk attributes).
|
||||
* cleanTargetList: the "clean" target list (junk attributes removed).
|
||||
* cleanLength: the length of 'cleanTargetList'
|
||||
* cleanTupType: the tuple descriptor of the "clean" tuple (with
|
||||
* cleanTupType: the tuple descriptor for the "clean" tuple (with
|
||||
* junk attributes removed).
|
||||
* cleanMap: A map with the correspondence between the non-junk
|
||||
* attribute numbers of the "original" tuple and the
|
||||
@ -235,10 +230,6 @@ typedef struct JunkFilter
|
||||
{
|
||||
NodeTag type;
|
||||
List *jf_targetList;
|
||||
int jf_length;
|
||||
TupleDesc jf_tupType;
|
||||
List *jf_cleanTargetList;
|
||||
int jf_cleanLength;
|
||||
TupleDesc jf_cleanTupType;
|
||||
AttrNumber *jf_cleanMap;
|
||||
TupleTableSlot *jf_resultSlot;
|
||||
|
Reference in New Issue
Block a user