pgsql: Refactor assembly of external on-disk TOAST pointers

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Refactor assembly of external on-disk TOAST pointers
Date: 2026-09-28 03:12:54
Message-ID: E1xB1nS-00000001Xro-0eAe@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Refactor assembly of external on-disk TOAST pointers

toast_save_datum() ended with two copies of the same three steps, one
each external on-disk TOAST pointer: allocate a datum, set its tag, then
copy the contents from a varatt_external_oid or a varatt_external_oid8
into it.

These steps are moved into a new helper function, toast_pointer_build(),
which takes the tag and a pointer to the struct and derives everything
else from the tag. For now, only two varatt_external_* exist for
external on-disk TOAST pointers. Some more are under discussion, where
this refactoring shows some benefits in the shape of less duplication.

There should be no behavior change.

Author: Nikhil Kumar Veldanda <veldanda(dot)nikhilkumar17(at)gmail(dot)com>
Discussion: https://postgr.es/m/CAFAfj_FeJQZrKyVn7ur0aJx8iz8SR14NheVJNyc8JNoqtMX+og@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/74f7f684d6ed1fd3c3aee4d868f2e6d1da0ec93b

Modified Files
--------------
src/backend/access/common/toast_internals.c | 28 ++++++++++++++++++++++------
1 file changed, 22 insertions(+), 6 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2026-09-28 03:35:54 pgsql: Replace OID8_FORMAT with more portable PRIu64
Previous Message Michael Paquier 2026-09-27 21:55:38 pgsql: Enforce pg_class.relchecks limit (32,767 or INT16_MAX)