@ -26,7 +26,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $ Header : / cvsroot / pgsql / src / backend / executor / execMain . c , v 1.97 1999 / 10 / 07 04 : 23 : 01 tgl Exp $
* $ Header : / cvsroot / pgsql / src / backend / executor / execMain . c , v 1.98 1999 / 10 / 30 23 : 13 : 30 tgl Exp $
*
*
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
*/
@ -529,7 +529,6 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
Relation intoRelationDesc ;
Relation intoRelationDesc ;
TupleDesc tupType ;
TupleDesc tupType ;
List * targetList ;
List * targetList ;
int len ;
/*
/*
* get information from query descriptor
* get information from query descriptor
@ -655,40 +654,43 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
*/
*/
tupType = ExecGetTupType ( plan ) ; /* tuple descriptor */
tupType = ExecGetTupType ( plan ) ; /* tuple descriptor */
targetList = plan - > targetlist ;
targetList = plan - > targetlist ;
len = ExecTargetListLength ( targetList ) ; /* number of attributes */
/*
/*
* now that we have the target list , initialize the junk filter if
* Now that we have the target list , initialize the junk filter if needed .
* this is a REPLACE or a DELETE query . We also init the junk filter
* SELECT and INSERT queries need a filter if there are any junk attrs
* if this is an append query ( there might be some rule lock info
* in the tlist . UPDATE and DELETE always need one , since there ' s always
* there . . . ) NOTE : in the future we might want to initialize the junk
* a junk ' ctid ' attribute present - - - no need to look first .
* filter for all queries . SELECT added by daveh @ insightdist . com
* 5 / 20 / 98 to allow ORDER / GROUP BY have an identifier missing from the
* target .
*/
*/
{
{
bool junk_filter_needed = false ;
bool junk_filter_needed = false ;
List * tlist ;
List * tlist ;
if ( operation = = CMD_SELECT )
switch ( operation )
{
{
foreach ( tlist , targetList )
case CMD_SELECT :
{
case CMD_INSERT :
TargetEntry * tle = lfirst ( tlist ) ;
foreach ( tlist , targetList )
if ( tle - > resdom - > resjunk )
{
{
junk_filter_needed = true ;
TargetEntry * tle = ( TargetEntry * ) lfirst ( tlist ) ;
break ;
if ( tle - > resdom - > resjunk )
{
junk_filter_needed = true ;
break ;
}
}
}
}
break ;
case CMD_UPDATE :
case CMD_DELETE :
junk_filter_needed = true ;
break ;
default :
break ;
}
}
if ( operation = = CMD_UPDATE | | operation = = CMD_DELETE | |
if ( junk_filter_needed )
operation = = CMD_INSERT | |
( operation = = CMD_SELECT & & junk_filter_needed ) )
{
{
JunkFilter * j = ( JunkFilter * ) ExecInitJunkFilter ( targetList ) ;
JunkFilter * j = ExecInitJunkFilter ( targetList , tupType ) ;
estate - > es_junkFilter = j ;
estate - > es_junkFilter = j ;