Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mNzZp-00079r-U2 for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Sep 2021 15:33:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mNzZo-0005hZ-3Z for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Sep 2021 15:33:28 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mNzZn-0005hQ-SI for pgsql-hackers@lists.postgresql.org; Wed, 08 Sep 2021 15:33:27 +0000 Received: from feynman.df7cb.de ([195.49.152.168]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mNzZl-0007KF-L0 for pgsql-hackers@postgresql.org; Wed, 08 Sep 2021 15:33:27 +0000 Received: from msg.df7cb.de (unknown [IPv6:2003:5b:203b:100:7627:eaff:fe52:8e03]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) by feynman.df7cb.de (Postfix) with ESMTPSA id 4H4R426fYBz3DyC; Wed, 8 Sep 2021 17:33:22 +0200 (CEST) Date: Wed, 8 Sep 2021 17:33:22 +0200 From: Christoph Berg To: Robert Haas Cc: PostgreSQL Hackers Subject: Re: VARDATA_COMPRESSED_GET_COMPRESS_METHOD comment? Message-ID: Mail-Followup-To: Christoph Berg , Robert Haas , PostgreSQL Hackers References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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