@ -712,7 +712,6 @@ ExecEvalWholeRowVar(WholeRowVarExprState *wrvstate, ExprContext *econtext,
{
{
Var * variable = ( Var * ) wrvstate - > xprstate . expr ;
Var * variable = ( Var * ) wrvstate - > xprstate . expr ;
TupleTableSlot * slot ;
TupleTableSlot * slot ;
TupleDesc slot_tupdesc ;
bool needslow = false ;
bool needslow = false ;
if ( isDone )
if ( isDone )
@ -804,25 +803,14 @@ ExecEvalWholeRowVar(WholeRowVarExprState *wrvstate, ExprContext *econtext,
if ( wrvstate - > wrv_junkFilter ! = NULL )
if ( wrvstate - > wrv_junkFilter ! = NULL )
slot = ExecFilterJunk ( wrvstate - > wrv_junkFilter , slot ) ;
slot = ExecFilterJunk ( wrvstate - > wrv_junkFilter , slot ) ;
slot_tupdesc = slot - > tts_tupleDescriptor ;
/*
/*
* If it ' s a RECORD Var , we ' ll use the slot ' s type ID info . It ' s likely
* that the slot ' s type is also RECORD ; if so , make sure it ' s been
* " blessed " , so that the Datum can be interpreted later .
*
* If the Var identifies a named composite type , we must check that the
* If the Var identifies a named composite type , we must check that the
* actual tuple type is compatible with it .
* actual tuple type is compatible with it .
*/
*/
if ( variable - > vartype = = RECORDOID )
if ( variable - > vartype ! = RECORDOID )
{
if ( slot_tupdesc - > tdtypeid = = RECORDOID & &
slot_tupdesc - > tdtypmod < 0 )
assign_record_type_typmod ( slot_tupdesc ) ;
}
else
{
{
TupleDesc var_tupdesc ;
TupleDesc var_tupdesc ;
TupleDesc slot_tupdesc ;
int i ;
int i ;
/*
/*
@ -839,6 +827,8 @@ ExecEvalWholeRowVar(WholeRowVarExprState *wrvstate, ExprContext *econtext,
*/
*/
var_tupdesc = lookup_rowtype_tupdesc ( variable - > vartype , - 1 ) ;
var_tupdesc = lookup_rowtype_tupdesc ( variable - > vartype , - 1 ) ;
slot_tupdesc = slot - > tts_tupleDescriptor ;
if ( var_tupdesc - > natts ! = slot_tupdesc - > natts )
if ( var_tupdesc - > natts ! = slot_tupdesc - > natts )
ereport ( ERROR ,
ereport ( ERROR ,
( errcode ( ERRCODE_DATATYPE_MISMATCH ) ,
( errcode ( ERRCODE_DATATYPE_MISMATCH ) ,
@ -896,6 +886,7 @@ ExecEvalWholeRowFast(WholeRowVarExprState *wrvstate, ExprContext *econtext,
{
{
Var * variable = ( Var * ) wrvstate - > xprstate . expr ;
Var * variable = ( Var * ) wrvstate - > xprstate . expr ;
TupleTableSlot * slot ;
TupleTableSlot * slot ;
TupleDesc slot_tupdesc ;
HeapTupleHeader dtuple ;
HeapTupleHeader dtuple ;
if ( isDone )
if ( isDone )
@ -925,6 +916,20 @@ ExecEvalWholeRowFast(WholeRowVarExprState *wrvstate, ExprContext *econtext,
if ( wrvstate - > wrv_junkFilter ! = NULL )
if ( wrvstate - > wrv_junkFilter ! = NULL )
slot = ExecFilterJunk ( wrvstate - > wrv_junkFilter , slot ) ;
slot = ExecFilterJunk ( wrvstate - > wrv_junkFilter , slot ) ;
/*
* If it ' s a RECORD Var , we ' ll use the slot ' s type ID info . It ' s likely
* that the slot ' s type is also RECORD ; if so , make sure it ' s been
* " blessed " , so that the Datum can be interpreted later . ( Note : we must
* do this here , not in ExecEvalWholeRowVar , because some plan trees may
* return different slots at different times . We have to be ready to
* bless additional slots during the run . )
*/
slot_tupdesc = slot - > tts_tupleDescriptor ;
if ( variable - > vartype = = RECORDOID & &
slot_tupdesc - > tdtypeid = = RECORDOID & &
slot_tupdesc - > tdtypmod < 0 )
assign_record_type_typmod ( slot_tupdesc ) ;
/*
/*
* Copy the slot tuple and make sure any toasted fields get detoasted .
* Copy the slot tuple and make sure any toasted fields get detoasted .
*/
*/