Re: pg_column_toast_chunk_id: a function to get a chunk ID of a TOASTed value
Yugo Nagata <nagata@sraoss.co.jp>
From: Yugo NAGATA <nagata@sraoss.co.jp>
To: Yugo NAGATA <nagata@sraoss.co.jp>
Cc: Nikita Malakhov <hukutoc@gmail.com>, pgsql-hackers@postgresql.org
Date: 2023-07-07T08:30:15Z
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 →
-
Add pg_column_toast_chunk_id().
- d1162cfda885 17.0 landed
Attachments
- v2_pg_column_toast_chunk_id.patch (text/x-diff) patch v2
On Fri, 7 Jul 2023 17:21:36 +0900 Yugo NAGATA <nagata@sraoss.co.jp> wrote: > 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 number for the chunk within its value), and chunk_data (the actual data of the chunk). A unique index on chunk_id and chunk_seq provides fast retrieval of the values. A pointer datum representing an out-of-line on-disk TOASTed value therefore needs 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. I attached v2 patch that contains the documentation fix. Regards, Yugo Nagata > > Regards, > Yugo Nagata > > > > > -- > > Regards, > > Nikita Malakhov > > Postgres Professional > > The Russian Postgres Company > > https://postgrespro.ru/ > > > -- > Yugo NAGATA <nagata@sraoss.co.jp> > > -- Yugo NAGATA <nagata@sraoss.co.jp>