Re: pg_column_toast_chunk_id: a function to get a chunk ID of a TOASTed value - Mailing list pgsql-hackers

From Yugo NAGATA
Subject Re: pg_column_toast_chunk_id: a function to get a chunk ID of a TOASTed value
Date
Msg-id 20230707172136.9dc1af99e3e237187c2b3d02@sraoss.co.jp
Whole thread Raw
In response to Re: pg_column_toast_chunk_id: a function to get a chunk ID of a TOASTed value  (Nikita Malakhov <hukutoc@gmail.com>)
Responses Re: pg_column_toast_chunk_id: a function to get a chunk ID of a TOASTed value
List pgsql-hackers
Hi Nikita,

On Wed, 5 Jul 2023 17:49:20 +0300
Nikita Malakhov <hukutoc@gmail.com> wrote:

> Hi!
> 
> I like the idea of having a standard function which shows a TOAST value ID
> for a row. I've used my own to handle TOAST errors. Just, maybe, more
> correct
> name would be "...value_id", because you actually retrieve valueid field
> from the TOAST pointer, and chunk ID consists of valueid + chunk_seq.

Thank you for your review!

Although, the retrieved field is "va_valueid" and it is called "value ID" in the
code, I chose the name "..._chunk_id" because I found the description in the
documentation as followings:

-------------
Every TOAST table has the columns chunk_id (an OID identifying the particular TOASTed value), chunk_seq (a sequence
numberfor the chunk within its value), and chunk_data (the actual data of the chunk). A unique index on chunk_id and
chunk_seqprovides fast retrieval of the values. A pointer datum representing an out-of-line on-disk TOASTed value
thereforeneeds to store the OID of the TOAST table in which to look and the OID of the specific value (its chunk_id)
 
-------------
https://www.postgresql.org/docs/devel/storage-toast.html

Here, chunk_id defined separately from chunk_seq. Therefore, I wonder  
pg_column_toast_chunk_id would be ok. However, I don't insist on this
and I would be happy to change it if the other name is more natural for users.

Regards,
Yugo Nagata

> 
> -- 
> Regards,
> Nikita Malakhov
> Postgres Professional
> The Russian Postgres Company
> https://postgrespro.ru/


-- 
Yugo NAGATA <nagata@sraoss.co.jp>



pgsql-hackers by date:

Previous
From: Masahiko Sawada
Date:
Subject: Re: Add hint message for check_log_destination()
Next
From: Yugo NAGATA
Date:
Subject: Re: pg_column_toast_chunk_id: a function to get a chunk ID of a TOASTed value