VARDATA_COMPRESSED_GET_COMPRESS_METHOD comment? - Mailing list pgsql-hackers

From Christoph Berg
Subject VARDATA_COMPRESSED_GET_COMPRESS_METHOD comment?
Date
Msg-id YTeLipdnSOg4NNcI@msg.df7cb.de
Whole thread Raw
Responses Re: VARDATA_COMPRESSED_GET_COMPRESS_METHOD comment?
List pgsql-hackers
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



pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: [PATCH] Add `verify-system` sslmode to use system CA pool for server cert
Next
From: Amul Sul
Date:
Subject: Re: [Patch] ALTER SYSTEM READ ONLY