Re: Dead code with short varlenas in toast_save_datum()

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Nikhil Kumar Veldanda <veldanda.nikhilkumar17@gmail.com>
Cc: Postgres hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-08-06T01:30:54Z
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 →
  1. Add isolation test for TOAST value reuse during CLUSTER

  2. Add SQL test for TOAST value allocations on rewrite

  3. Add regression test for short varlenas saved in TOAST relations

On Tue, Aug 05, 2025 at 10:26:03AM -0700, Nikhil Kumar Veldanda wrote:
> 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));

Ah, thanks, nice one.  I did not consider the trick of using two
attributes to bypass the check when externalizing the tuple.  I'll go
add a test in strings.sql among these lines, with some TOAST slice
scans based on substr().
--
Michael