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 1lOMmq-0001KD-6f for pgsql-hackers@arkaria.postgresql.org; Mon, 22 Mar 2021 15:48:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lOMmo-00007k-J5 for pgsql-hackers@arkaria.postgresql.org; Mon, 22 Mar 2021 15:48:10 +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 1lOMmo-00007c-CR for pgsql-hackers@lists.postgresql.org; Mon, 22 Mar 2021 15:48:10 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lOMmm-0002Xr-1O for pgsql-hackers@lists.postgresql.org; Mon, 22 Mar 2021 15:48:10 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 12MFlxHw574198; Mon, 22 Mar 2021 11:48:00 -0400 From: Tom Lane To: Robert Haas cc: Dilip Kumar , Justin Pryzby , Andres Freund , Tomas Vondra , Alexander Korotkov , David Steele , Ildus Kurbangaliev , Dmitry Dolgov <9erthalion6@gmail.com>, Andrey Borodin , PostgreSQL Hackers Subject: Re: [HACKERS] Custom compression methods (mac+lz4.h) In-reply-to: References: <301730.1616276227@sss.pgh.pa.us> <20210320231957.GX11765@telsasoft.com> <309337.1616287493@sss.pgh.pa.us> <311370.1616290403@sss.pgh.pa.us> <414943.1616358751@sss.pgh.pa.us> <20210321204148.GB4203@telsasoft.com> <456616.1616360715@sss.pgh.pa.us> <504396.1616368310@sss.pgh.pa.us> <20210321234324.GC4203@telsasoft.com> <507597.1616370729@sss.pgh.pa.us> <558766.1616424108@sss.pgh.pa.us> Comments: In-reply-to Robert Haas message dated "Mon, 22 Mar 2021 11:29:10 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <574196.1616428079.1@sss.pgh.pa.us> Date: Mon, 22 Mar 2021 11:47:59 -0400 Message-ID: <574197.1616428079@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Robert Haas writes: > On Mon, Mar 22, 2021 at 10:41 AM Tom Lane wrote: >> Yeah, I thought about that too, but do we want to assume that >> VARRAWSIZE_4B_C is the correct way to get the decompressed size >> for all compression methods? > I think it's OK to assume this. OK, cool. >> (If so, I think it would be better style to have a less opaque macro >> name for the purpose.) > Complaining about the name of one particular TOAST-related macro name > seems a bit like complaining about the greenhouse gasses emitted by > one particular car. Maybe, but that's not a reason to make it worse. Anyway, my understanding of that is that the really opaque names are *only* meant to be used in this very stretch of postgres.h, ie they are just intermediate steps on the way to the macros below them. As an example, the only use of VARDATA_1B_E() is in VARDATA_EXTERNAL(). > Anyway, this particular macro name was chosen, it seems, for symmetry > with VARDATA_4B_C, but if you want to change it to something else, I'm > OK with that, too. After looking at postgres.h for a bit, I'm thinking that what these should have been symmetric with is the considerably-less-terrible names used for the corresponding VARATT_EXTERNAL cases. Thus, something like s/VARRAWSIZE_4B_C/VARDATA_COMPRESSED_GET_RAWSIZE/ s/VARCOMPRESS_4B_C/VARDATA_COMPRESSED_GET_COMPRESSION/ Possibly the former names should survive and the latter become wrappers around them, not sure. But we shouldn't be using the "4B" terminology anyplace except this part of postgres.h. regards, tom lane