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 1lpz4t-0006X4-3F for pgsql-hackers@arkaria.postgresql.org; Sun, 06 Jun 2021 20:08:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lpz4r-0006JJ-U8 for pgsql-hackers@arkaria.postgresql.org; Sun, 06 Jun 2021 20:08:57 +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 1lpz4r-0006JB-MV for pgsql-hackers@lists.postgresql.org; Sun, 06 Jun 2021 20:08:57 +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 1lpz4p-0000UB-Tm for pgsql-hackers@postgresql.org; Sun, 06 Jun 2021 20:08:57 +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 156K8qgG703787; Sun, 6 Jun 2021 16:08:52 -0400 From: Tom Lane To: Tomas Vondra cc: Noah Misch , Dean Rasheed , Justin Pryzby , PostgreSQL Hackers Subject: Re: PoC/WIP: Extended statistics on expressions In-reply-to: <2392f864-7ec1-38bb-1e78-71a9b2d78a95@enterprisedb.com> References: <1ed534fb-b42b-f008-35ee-4eb930b0088f@enterprisedb.com> <2cb8a7cd-664f-8681-6ce9-790a50e3c78f@enterprisedb.com> <096d26e1-f053-a039-047d-a050dbb80ac6@enterprisedb.com> <078de413-8e4e-343e-fac1-eb61fd389925@enterprisedb.com> <20210606053740.GB297923@rfd.leadboat.com> <4c98203c-8364-bb76-b502-d7b323ba55ba@enterprisedb.com> <660936.1623007056@sss.pgh.pa.us> <2392f864-7ec1-38bb-1e78-71a9b2d78a95@enterprisedb.com> Comments: In-reply-to Tomas Vondra message dated "Sun, 06 Jun 2021 22:01:23 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <703785.1623010132.1@sss.pgh.pa.us> Date: Sun, 06 Jun 2021 16:08:52 -0400 Message-ID: <703786.1623010132@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Tomas Vondra writes: > On 6/6/21 9:17 PM, Tom Lane wrote: >> I'm curious about how come the buildfarm didn't notice this. The >> animals using COPY_PARSE_PLAN_TREES should have failed. The fact >> that they didn't implies that there's no test case that makes use >> of a nonzero value for this field, which seems like a testing gap. > AFAICS the reason is pretty simple - the COPY_PARSE_PLAN_TREES checks > look like this: > ... > But if the field is missing from all the functions, equal() can't detect > that copyObject() did not actually copy it. Right, that code would only detect a missing copyfuncs.c line if equalfuncs.c did have the line, which isn't all that likely. However, we then pass the copied node on to further processing, which in principle should result in visible failures when copyfuncs.c is missing a line. I think the reason it didn't is that the transformed field would always be zero (false) in grammar output. We could only detect a problem if we copied already-transformed nodes and then used them further. Even then it *might* not fail, because the consequence would likely be an extra round of parse analysis on the expressions, which is likely to be a no-op. Not sure if there's a good way to improve that. I hope sometime soon we'll be able to auto-generate these functions, and then the risk of this sort of mistake will go away (he says optimistically). regards, tom lane