Re: Dead code with short varlenas in toast_save_datum()

From: Nikita Malakhov <hukutoc(at)gmail(dot)com>
To: Nikhil Kumar Veldanda <veldanda(dot)nikhilkumar17(at)gmail(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Dead code with short varlenas in toast_save_datum()
Date: 2025-08-05 20:07:45
Message-ID: CAN-LCVM5+J_QvTX7FwywCJFXAba3y8XUCbM+O+gY7qyesxWjjQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Nikhil, thank you! This case should be added to regressions.

On Tue, Aug 5, 2025 at 8:26 PM Nikhil Kumar Veldanda <
veldanda(dot)nikhilkumar17(at)gmail(dot)com> wrote:

> Hi all,
>
> On Sun, Aug 3, 2025 at 8:16 PM Michael Paquier <michael(at)paquier(dot)xyz>
> wrote:
> > if (VARATT_IS_SHORT(dval))
> > {
> > data_p = VARDATA_SHORT(dval);
> > data_todo = VARSIZE_SHORT(dval) - VARHDRSZ_SHORT;
> > toast_pointer.va_rawsize = data_todo + VARHDRSZ; /* as if not
> short */
> > toast_pointer.va_extinfo = data_todo;
> > }
> >
> > Coverage link:
> >
> https://coverage.postgresql.org/src/backend/access/common/toast_internals.c.gcov.html
> >
>
> This code path is currently not covered by tests. It can be exercised
> with the following SQL pattern
>
> CREATE TABLE temp_tbl (a text, b text);
> ALTER TABLE temp_tbl SET (toast_tuple_target = 128);
> ALTER TABLE temp_tbl ALTER COLUMN a SET STORAGE EXTERNAL;
> ALTER TABLE temp_tbl ALTER COLUMN b SET STORAGE EXTERNAL;
> INSERT INTO temp_tbl values(repeat('a', 4000), repeat('a', 120));
>
> --
> Nikhil Veldanda
>
>
>

--
Regards,
Nikita Malakhov
Postgres Professional
The Russian Postgres Company
https://postgrespro.ru/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2025-08-05 20:09:33 Re: Bug in brin_minmax_multi_distance_numeric()
Previous Message Nathan Bossart 2025-08-05 19:58:44 Re: More protocol.h replacements this time into walsender.c