From: Christoph Berg <myon@debian.org>
To: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Subject: VARDATA_COMPRESSED_GET_COMPRESS_METHOD comment?
Date: Tue, 7 Sep 2021 17:55:54 +0200
Message-ID: <YTeLipdnSOg4NNcI@msg.df7cb.de> (raw)
In postgres.h, there are these macros for working with compressed
toast:
vvvvvvvv
/* Decompressed size and compression method of an external compressed Datum */
#define VARDATA_COMPRESSED_GET_EXTSIZE(PTR) \
(((varattrib_4b *) (PTR))->va_compressed.va_tcinfo & VARLENA_EXTSIZE_MASK)
#define VARDATA_COMPRESSED_GET_COMPRESS_METHOD(PTR) \
(((varattrib_4b *) (PTR))->va_compressed.va_tcinfo >> VARLENA_EXTSIZE_BITS)
/* Same, when working directly with a struct varatt_external */
#define VARATT_EXTERNAL_GET_EXTSIZE(toast_pointer) \
((toast_pointer).va_extinfo & VARLENA_EXTSIZE_MASK)
#define VARATT_EXTERNAL_GET_COMPRESS_METHOD(toast_pointer) \
((toast_pointer).va_extinfo >> VARLENA_EXTSIZE_BITS)
On the first line, is the comment "external" correct? It took me quite
a while to realize that the first two macros are the methods to be
used on an *inline* compressed Datum, when the second set is used for
varlenas in toast tables.
Context: Me figuring out https://github.com/credativ/toastinfo/blob/master/toastinfo.c#L119-L128
Christoph
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: myon@debian.org
Subject: Re: VARDATA_COMPRESSED_GET_COMPRESS_METHOD comment?
In-Reply-To: <YTeLipdnSOg4NNcI@msg.df7cb.de>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox