From: | Christoph Berg <myon(at)debian(dot)org> |
---|---|
To: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | VARDATA_COMPRESSED_GET_COMPRESS_METHOD comment? |
Date: | 2021-09-07 15:55:54 |
Message-ID: | YTeLipdnSOg4NNcI@msg.df7cb.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Amul Sul | 2021-09-07 16:32:32 | Re: [Patch] ALTER SYSTEM READ ONLY |
Previous Message | Andrew Dunstan | 2021-09-07 15:52:08 | Re: [PATCH] Add `verify-system` sslmode to use system CA pool for server cert |