Re: Dead code with short varlenas in toast_save_datum()

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Nikhil Kumar Veldanda <veldanda(dot)nikhilkumar17(at)gmail(dot)com>
Cc: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Dead code with short varlenas in toast_save_datum()
Date: 2025-08-07 01:01:26
Message-ID: aJP65gcVnNnjmTsA@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Aug 06, 2025 at 10:30:54AM +0900, Michael Paquier wrote:
> 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().

Done that as of 225ebfe30a1a, with some additions:
- A check on pg_column_compression(), to make sure that the short
varlena path leads to an uncompressed on-disk Datum.
- Some substr() for the values, to cross-check slice reads.
- A query based on the TOAST relation's chunk_seq, making sure that we
have taken toast_save_datum() two times when inserting a tuple with
the two toastable attributes.

The buildfarm is OK with it, as is the latest patch for the 8-byte
TOAST values posted here:
https://www.postgresql.org/message-id/aIyCz4T858Kcm4UU@paquier.xyz

The patch posted there needs a rebase, following the changes in
varatt.h done in e035863c9a04. Will post a rebase very soon.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2025-08-07 01:33:02 Re: Datum as struct
Previous Message Euler Taveira 2025-08-07 00:34:58 Re: event trigger support for PL/Python