pgsql: Refactor assembly of external on-disk TOAST pointers - Mailing list pgsql-committers

From Michael Paquier
Subject pgsql: Refactor assembly of external on-disk TOAST pointers
Date
Msg-id E1xB1nS-00000001Xro-0eAe@gemulon.postgresql.org
Whole thread
List 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.nikhilkumar17@gmail.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(-)


pgsql-committers by date:

Previous
From: Michael Paquier
Date:
Subject: pgsql: Enforce pg_class.relchecks limit (32,767 or INT16_MAX)
Next
From: Michael Paquier
Date:
Subject: pgsql: Replace OID8_FORMAT with more portable PRIu64