Dead code in toast_fetch_datum_slice?

Поиск
Список
Период
Сортировка
От Stephen Frost
Тема Dead code in toast_fetch_datum_slice?
Дата
Msg-id 20181207232529.GR3415@tamriel.snowman.net
обсуждение исходный текст
Ответы Re: Dead code in toast_fetch_datum_slice?  (Paul Ramsey <pramsey@cleverelephant.ca>)
Список pgsql-hackers
Greetings,

Perhaps I'm missing something, but in toast_fetch_datum_slice() there's:

    Assert(!VARATT_EXTERNAL_IS_COMPRESSED(toast_pointer));

Followed, not long after, by:

    if (VARATT_EXTERNAL_IS_COMPRESSED(toast_pointer))
        SET_VARSIZE_COMPRESSED(result, length + VARHDRSZ);
    else
        SET_VARSIZE(result, length + VARHDRSZ);

Further, the only caller of this function today is
heap_tuple_untoast_attr_slice(), which does:

    /* fast path for non-compressed external datums */
    if (!VARATT_EXTERNAL_IS_COMPRESSED(toast_pointer))
        return toast_fetch_datum_slice(attr, sliceoffset, slicelength);

As such, I'm feeling like that conditional to handle the case where this
function is passed a compressed TOAST value is rather confusing dead
code.

Hence I'm proposing the attached.

Thoughts?

Thanks!

Stephen

Вложения

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

Предыдущее
От: John Naylor
Дата:
Сообщение: Re: Thinking about EXPLAIN ALTER TABLE
Следующее
От: Stephen Frost
Дата:
Сообщение: Re: pg_dump emits ALTER TABLE ONLY partitioned_table