Thread: BUG #14985: ExecCopySlotTuple not set "type id" and "type mod" whenfrom minial tuple"

BUG #14985: ExecCopySlotTuple not set "type id" and "type mod" whenfrom minial tuple"

From
PG Bug reporting form
Date:
The following bug has been logged on the website:

Bug reference:      14985
Logged by:          bucoo hsiao
Email address:      bucoo@sohu.com
PostgreSQL version: 10.1
Operating system:   all
Description:

HeapTuple
ExecCopySlotTuple(TupleTableSlot *slot)
{
    /*
     * sanity checks
     */
    Assert(slot != NULL);
    Assert(!slot->tts_isempty);

    /*
     * If we have a physical tuple (either format) then just copy it.
     */
    if (TTS_HAS_PHYSICAL_TUPLE(slot))
        return heap_copytuple(slot->tts_tuple);
    if (slot->tts_mintuple)
        return heap_tuple_from_minimal_tuple(slot->tts_mintuple);
/* should be:
        if (slot->tts_mintuple)
        {
                HeapTuple result =
heap_tuple_from_minimal_tuple(slot->tts_mintuple);
                HeapTupleHeaderSetTypeId(result->t_data,
slot->tts_tupleDescriptor->tdtypeid);
                HeapTupleHeaderSetTypMod(result->t_data,
slot->tts_tupleDescriptor->tdtypmod);
                return result;
        }
*/
    ...
}


Hi,

On 2017-12-20 10:05:40 +0000, PG Bug reporting form wrote:
> The following bug has been logged on the website:
> 
> Bug reference:      14985
> Logged by:          bucoo hsiao
> Email address:      bucoo@sohu.com
> PostgreSQL version: 10.1
> Operating system:   all
> Description:        

This also isn't a proper bug report. If you've API questions you
shouldn't open bug reports, instead ask on the general mailing list or
such.


> HeapTuple
> ExecCopySlotTuple(TupleTableSlot *slot)
> {
>     /*
>      * sanity checks
>      */
>     Assert(slot != NULL);
>     Assert(!slot->tts_isempty);
> 
>     /*
>      * If we have a physical tuple (either format) then just copy it.
>      */
>     if (TTS_HAS_PHYSICAL_TUPLE(slot))
>         return heap_copytuple(slot->tts_tuple);
>     if (slot->tts_mintuple)
>         return heap_tuple_from_minimal_tuple(slot->tts_mintuple);
> /* should be:
>         if (slot->tts_mintuple)
>         {
>                 HeapTuple result =
> heap_tuple_from_minimal_tuple(slot->tts_mintuple);
>                 HeapTupleHeaderSetTypeId(result->t_data,
> slot->tts_tupleDescriptor->tdtypeid);
>                 HeapTupleHeaderSetTypMod(result->t_data,
> slot->tts_tupleDescriptor->tdtypmod);
>                 return result;
>         }
> */
>     ...
> }
> 

No, it shouldn't. It seems you're looking for ExecFetchSlotTupleDatum().

Greetings,

Andres Freund


=?utf-8?q?PG_Bug_reporting_form?= <noreply@postgresql.org> writes:
> The following bug has been logged on the website:

The bug reporting form is not a good way to discuss proposed code changes,
especially when you haven't shown any reason to think there is a bug.
Please instead start a thread on pgsql-hackers explaining why this would
be a good change to make.  (Offhand I'd think it would be a waste of
code, because anything going through the minimal-tuple code path is
just about guaranteed to be an anonymous record type anyway.)

            regards, tom lane