From: Christoph Berg <myon@debian.org>
To: Robert Haas <robertmhaas@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Subject: Re: VARDATA_COMPRESSED_GET_COMPRESS_METHOD comment?
Date: Wed, 8 Sep 2021 17:33:22 +0200
Message-ID: <YTjXwhKH/4J6U48u@msg.df7cb.de> (raw)
In-Reply-To: <CA+TgmoatwbsYta9EdPM2HT_yysQ0BFo21-GandX1avVzwhzqgw@mail.gmail.com>
References: <YTeLipdnSOg4NNcI@msg.df7cb.de>
<CA+TgmoatwbsYta9EdPM2HT_yysQ0BFo21-GandX1avVzwhzqgw@mail.gmail.com>
Re: Robert Haas
> But I agree with you that referring to the argument to
> VARDATA_COMPRESSED_GET_EXTSIZE or
> VARDATA_COMPRESSED_GET_COMPRESS_METHOD as an "external compressed
> Datum" doesn't seem quite right. It is compressed, but it is not
> external, at least in the sense that I understand that term.
How about "compressed-in-line Datum" like on the comment 5 lines above?
/* caution: this will not work on an external or compressed-in-line Datum */
/* caution: this will return a possibly unaligned pointer */
#define VARDATA_ANY(PTR) \
(VARATT_IS_1B(PTR) ? VARDATA_1B(PTR) : VARDATA_4B(PTR))
/* 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)
This "external" there cost me about one hour of extra poking around
until I realized this is actually the macro I wanted.
-> /* Decompressed size and compression method of a compressed-in-line Datum */
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, robertmhaas@gmail.com
Subject: Re: VARDATA_COMPRESSED_GET_COMPRESS_METHOD comment?
In-Reply-To: <YTjXwhKH/4J6U48u@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