@ -122,9 +122,8 @@ tts_virtual_clear(TupleTableSlot *slot)
}
}
/*
/*
* Attribute values are readily available in tts_values and tts_isnull array
* VirtualTupleTableSlots always have fully populated tts_values and
* in a VirtualTupleTableSlot . So there should be no need to call either of the
* tts_isnull arrays . So this function should never be called .
* following two functions .
*/
*/
static void
static void
tts_virtual_getsomeattrs ( TupleTableSlot * slot , int natts )
tts_virtual_getsomeattrs ( TupleTableSlot * slot , int natts )
@ -132,10 +131,19 @@ tts_virtual_getsomeattrs(TupleTableSlot *slot, int natts)
elog ( ERROR , " getsomeattrs is not required to be called on a virtual tuple table slot " ) ;
elog ( ERROR , " getsomeattrs is not required to be called on a virtual tuple table slot " ) ;
}
}
/*
* VirtualTupleTableSlots never provide system attributes ( except those
* handled generically , such as tableoid ) . We generally shouldn ' t get
* here , but provide a user - friendly message if we do .
*/
static Datum
static Datum
tts_virtual_getsysattr ( TupleTableSlot * slot , int attnum , bool * isnull )
tts_virtual_getsysattr ( TupleTableSlot * slot , int attnum , bool * isnull )
{
{
elog ( ERROR , " virtual tuple table slot does not have system attributes " ) ;
Assert ( ! TTS_EMPTY ( slot ) ) ;
ereport ( ERROR ,
( errcode ( ERRCODE_FEATURE_NOT_SUPPORTED ) ,
errmsg ( " cannot retrieve a system column in this context " ) ) ) ;
return 0 ; /* silence compiler warnings */
return 0 ; /* silence compiler warnings */
}
}
@ -335,6 +343,15 @@ tts_heap_getsysattr(TupleTableSlot *slot, int attnum, bool *isnull)
Assert ( ! TTS_EMPTY ( slot ) ) ;
Assert ( ! TTS_EMPTY ( slot ) ) ;
/*
* In some code paths it ' s possible to get here with a non - materialized
* slot , in which case we can ' t retrieve system columns .
*/
if ( ! hslot - > tuple )
ereport ( ERROR ,
( errcode ( ERRCODE_FEATURE_NOT_SUPPORTED ) ,
errmsg ( " cannot retrieve a system column in this context " ) ) ) ;
return heap_getsysattr ( hslot - > tuple , attnum ,
return heap_getsysattr ( hslot - > tuple , attnum ,
slot - > tts_tupleDescriptor , isnull ) ;
slot - > tts_tupleDescriptor , isnull ) ;
}
}
@ -497,7 +514,11 @@ tts_minimal_getsomeattrs(TupleTableSlot *slot, int natts)
static Datum
static Datum
tts_minimal_getsysattr ( TupleTableSlot * slot , int attnum , bool * isnull )
tts_minimal_getsysattr ( TupleTableSlot * slot , int attnum , bool * isnull )
{
{
elog ( ERROR , " minimal tuple table slot does not have system attributes " ) ;
Assert ( ! TTS_EMPTY ( slot ) ) ;
ereport ( ERROR ,
( errcode ( ERRCODE_FEATURE_NOT_SUPPORTED ) ,
errmsg ( " cannot retrieve a system column in this context " ) ) ) ;
return 0 ; /* silence compiler warnings */
return 0 ; /* silence compiler warnings */
}
}
@ -681,6 +702,15 @@ tts_buffer_heap_getsysattr(TupleTableSlot *slot, int attnum, bool *isnull)
Assert ( ! TTS_EMPTY ( slot ) ) ;
Assert ( ! TTS_EMPTY ( slot ) ) ;
/*
* In some code paths it ' s possible to get here with a non - materialized
* slot , in which case we can ' t retrieve system columns .
*/
if ( ! bslot - > base . tuple )
ereport ( ERROR ,
( errcode ( ERRCODE_FEATURE_NOT_SUPPORTED ) ,
errmsg ( " cannot retrieve a system column in this context " ) ) ) ;
return heap_getsysattr ( bslot - > base . tuple , attnum ,
return heap_getsysattr ( bslot - > base . tuple , attnum ,
slot - > tts_tupleDescriptor , isnull ) ;
slot - > tts_tupleDescriptor , isnull ) ;
}
}