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

Поиск
Список
Период
Сортировка
Искать
От
Tsunakawa, Takayuki
Тема
[bug fix??] Fishy code in tts_cirtual_copyslot()
Дата
Msg-id
0A3221C70F24FB45833433255569204D1FD34C0E@G01JPEXMBYT05
Список
Дерево обсуждения
[bug fix??] Fishy code in tts_cirtual_copyslot() "Tsunakawa, Takayuki" <tsunakawa.takay@jp.fujitsu.com>
Re: [bug fix??] Fishy code in tts_cirtual_copyslot() Tom Lane <tgl@sss.pgh.pa.us>
RE: [bug fix??] Fishy code in tts_cirtual_copyslot() "Tsunakawa, Takayuki" <tsunakawa.takay@jp.fujitsu.com>
Re: [bug fix??] Fishy code in tts_cirtual_copyslot() Andres Freund <andres@anarazel.de>
Hello,

In the following code in execTuples.c, shouldn' srcdesc point to the source slot's tuple descriptor?  The attached fix passes make 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 function writes "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
Дата:
От: Peter Geoghegan
Дата:
FAQ