Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hIbsv-00009z-I2 for pgsql-hackers@arkaria.postgresql.org; Mon, 22 Apr 2019 16:33:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hIbss-0008FS-0z for pgsql-hackers@arkaria.postgresql.org; Mon, 22 Apr 2019 16:33:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hIbsr-0008DF-Ob for pgsql-hackers@lists.postgresql.org; Mon, 22 Apr 2019 16:33:33 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hIbso-0007xd-82 for pgsql-hackers@postgresql.org; Mon, 22 Apr 2019 16:33:32 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x3MGXOxa016491; Mon, 22 Apr 2019 12:33:24 -0400 From: Tom Lane To: Alvaro Herrera cc: Andres Freund , Michael Paquier , Justin Pryzby , pgsql-hackers@postgresql.org Subject: Re: clean up docs for v12 In-reply-to: <20190422161955.GA17411@alvherre.pgsql> References: <20190422161955.GA17411@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Mon, 22 Apr 2019 12:19:55 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <16489.1555950804.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 22 Apr 2019 12:33:24 -0400 Message-ID: <16490.1555950804@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Alvaro Herrera writes: > On 2019-Apr-22, Andres Freund wrote: >> On 2019-04-22 14:48:26 +0900, Michael Paquier wrote: >>> /* >>> - * Check if's guaranteed the all the desired attributes are availabl= e in >>> - * tuple. If so, we can start deforming. If not, need to make sure t= o >>> - * fetch the missing columns. >>> + * Check if all the desired attributes are available in the tuple. = If so, >>> + * we can start deforming. If not, we need to make sure to fetch th= e >>> + * missing columns. >>> */ >> That's imo not an improvement. The guaranteed bit is actually >> relevant. What this block is doing is eliding the check against the >> tuple header for the number of attributes, if NOT NULL attributes for >> later columns guarantee that the desired columns are present in the NUL= L >> bitmap. But the rephrasing makes it sound like we're actually checking >> against the tuple. >> = >> I think it'd be better just to fix s/the all/that all/. > (and s/if's/if it's/) ISTM that Michael's proposed wording change shows that the existing comment is easily misinterpreted. I don't think these minor grammatical fixes will avoid the misinterpretation problem, and so some more-extensive rewording is called for. But TBH, now that I look at the code, I think the entire optimization is a bad idea and should be removed. Am I right in thinking that the presence of a wrong attnotnull marker could cause the generated code to actually crash, thanks to not checking the tuple's natts field? I don't have enough faith in our enforcement of those constraints to want to see JIT taking that risk to save a nanosecond or two. (Possibly I'd not think this if I weren't fresh off a couple of days with my nose in the ALTER TABLE SET NOT NULL code. But right now, I think that believing that that code does not and never will have any bugs is just damfool.) regards, tom lane