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 1o4wej-0006n5-Aq for pgsql-hackers@arkaria.postgresql.org; Sat, 25 Jun 2022 03:40:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1o4wdh-0007qy-S1 for pgsql-hackers@arkaria.postgresql.org; Sat, 25 Jun 2022 03:39:17 +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 1o4wdh-0007qp-It for pgsql-hackers@lists.postgresql.org; Sat, 25 Jun 2022 03:39:17 +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 1o4wdc-0004dC-0m for pgsql-hackers@lists.postgresql.org; Sat, 25 Jun 2022 03:39:13 +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 25P3d9tt631352; Fri, 24 Jun 2022 23:39:09 -0400 From: Tom Lane To: Dean Rasheed cc: PostgreSQL Hackers Subject: Re: Core dump in range_table_mutator() In-reply-to: References: <545569.1656107045@sss.pgh.pa.us> Comments: In-reply-to Dean Rasheed message dated "Sat, 25 Jun 2022 03:10:02 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <631350.1656128349.1@sss.pgh.pa.us> Date: Fri, 24 Jun 2022 23:39:09 -0400 Message-ID: <631351.1656128349@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Dean Rasheed writes: > Not directly related to that change ... I think it would be easier to > follow if the CHECKFLATCOPY() was replaced with a separate Assert() > and FLATCOPY() (I had to go and remind myself what CHECKFLATCOPY() > did). > Doing that would allow CHECKFLATCOPY() to be deleted, since this is > the only place that uses it -- every other case knows the node type is > correct before doing a FLATCOPY(). Well, if we want to clean this up a bit rather than just doing the minimum safe fix ... I spent some time why we were bothering with the FLATCOPY step at all, rather than just mutating the Query* pointer. I think the reason is to not fail if the QTW_DONT_COPY_QUERY flag is set, but maybe we should clear that flag when recursing? regards, tom lane