[bug fix??] Fishy code in tts_cirtual_copyslot()

Поиск
Список
Период
Сортировка
От Tsunakawa, Takayuki
Тема [bug fix??] Fishy code in tts_cirtual_copyslot()
Дата
Msg-id 0A3221C70F24FB45833433255569204D1FD34C0E@G01JPEXMBYT05
обсуждение исходный текст
Ответы Re: [bug fix??] Fishy code in tts_cirtual_copyslot()  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hello,

In the following code in execTuples.c, shouldn' srcdesc point to the source slot's tuple descriptor?  The attached fix
passesmake check.  What kind of failure could this cause?
 

BTW, I thought that in PostgreSQL coding convention, local variables should be defined at the top of blocks, but this
functionwrites "for (int natts;".  I didn't modify it because many other source files also write in that way.
 


--------------------------------------------------
static void
tts_virtual_copyslot(TupleTableSlot *dstslot, TupleTableSlot *srcslot)
{
    TupleDesc   srcdesc = dstslot->tts_tupleDescriptor;

    Assert(srcdesc->natts <= dstslot->tts_tupleDescriptor->natts);

    tts_virtual_clear(dstslot);

    slot_getallattrs(srcslot);

    for (int natt = 0; natt < srcdesc->natts; natt++)
    {
        dstslot->tts_values[natt] = srcslot->tts_values[natt];
        dstslot->tts_isnull[natt] = srcslot->tts_isnull[natt];
    }
--------------------------------------------------


Regards
Takayuki Tsunakawa


Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Leakproofness of texteq()/textne()
Следующее
От: Peter Geoghegan
Дата:
Сообщение: Re: [HACKERS] [WIP] Effective storage of duplicates in B-tree index.