Re: Dead code with short varlenas in toast_save_datum()
Nikhil Kumar Veldanda <veldanda.nikhilkumar17@gmail.com>
From: Nikhil Kumar Veldanda <veldanda.nikhilkumar17@gmail.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Postgres hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-08-05T17:26:03Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Add isolation test for TOAST value reuse during CLUSTER
- f57e214d1cbb 19 (unreleased) landed
-
Add SQL test for TOAST value allocations on rewrite
- 69f75d671475 19 (unreleased) landed
-
Add regression test for short varlenas saved in TOAST relations
- 225ebfe30a1a 19 (unreleased) landed
Hi all,
On Sun, Aug 3, 2025 at 8:16 PM Michael Paquier <michael@paquier.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