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-17T06:26:20Z
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 Sat, Aug 16, 2025 at 02:34:02AM -0700, Nikhil Kumar Veldanda wrote:
> Thanks for the guidance. I’ve updated the isolation test to use a CTAS
> capturing (id, chunk_id) pre-CLUSTER and added a post-CLUSTER join to
> verify the chunk IDs match. I also reduced the number of tuples to 1.
> 
> Please find the attached patch for your review. Thanks

Cool, thanks for the new patch.  The structure looks OK.  There were
two things that itched me a bit:
- Instead of reporting the number of tuples where the chunk IDs do not
match across the rewrites, I have rewritten the query to report the
serial IDs, instead.
- Making sure that the CTAS holds some data, matching with the number
of tuples inserted.  A count(*) was enough for that. 
--
Michael