A PostgreSQL extension for inspecting TOAST (The Oversized-Attribute Storage Technique) information at a low level.

pg_toastinspect provides functions to access TOAST metadata for large values stored in PostgreSQL. It allows you to retrieve chunk IDs and detailed TOAST pointer information without having to examine the internal data structures directly.
make
make install
CREATE EXTENSION pg_toastinspect;
The extension provides two main functions, overloaded for text, bytea, and jsonb types:
get_toast_chunk_id(val) - Returns the chunk ID (OID) of a TOASTed value, or NULL if the value is not TOASTed.
get_toast_info(val) - Returns complete TOAST pointer information as a composite type toast_pointer_info with these fields:
raw_size - Original uncompressed size of the valueext_size - Size after TOAST storage (possibly compressed)chunk_id - Chunk identifier (OID)reltoastrelid - OID of the TOAST table-- Get the chunk ID of a TOASTed value
SELECT ctid, id, get_toast_chunk_id(response_content), response_content
FROM ai_call_log_copy1
WHERE id = 668310181431480320;
-- Get complete TOAST information
SELECT ctid, id, get_toast_info(response_content), response_content
FROM ai_call_log_copy1
WHERE id = 668310181431480320;
-- Access individual fields from the composite type
SELECT
ctid,
id,
(get_toast_info(response_content)).raw_size,
(get_toast_info(response_content)).ext_size,
(get_toast_info(response_content)).chunk_id,
(get_toast_info(response_content)).reltoastrelid
FROM ai_call_log_copy1
WHERE id = 668310181431480320;