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 1mCliS-0003kC-TN for pgsql-hackers@arkaria.postgresql.org; Sun, 08 Aug 2021 16:32:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mCliQ-0006dB-PT for pgsql-hackers@arkaria.postgresql.org; Sun, 08 Aug 2021 16:31:58 +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 1mCliQ-0006d3-Hl for pgsql-hackers@lists.postgresql.org; Sun, 08 Aug 2021 16:31:58 +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 1mCliO-0006dq-GI for pgsql-hackers@postgresql.org; Sun, 08 Aug 2021 16:31:58 +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 178GVrYo3168352; Sun, 8 Aug 2021 12:31:54 -0400 From: Tom Lane To: Mark Dilger cc: PostgreSQL-development Subject: Re: Assert triggered during RE_compile_and_cache In-reply-to: <2860330.1628384606@sss.pgh.pa.us> References: <0203588E-E609-43AF-9F4F-902854231EE7@enterprisedb.com> <7F9BFA6F-9BC6-4A27-BFA1-2F01682BD644@enterprisedb.com> <2426993.1628201727@sss.pgh.pa.us> <29C525E6-A912-459F-BE27-217F25F76B5E@enterprisedb.com> <2437330.1628205382@sss.pgh.pa.us> <2442241.1628208783@sss.pgh.pa.us> <2822987.1628372679@sss.pgh.pa.us> <2860330.1628384606@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Sat, 07 Aug 2021 21:03:26 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3168350.1628440313.1@sss.pgh.pa.us> Date: Sun, 08 Aug 2021 12:31:53 -0400 Message-ID: <3168351.1628440313@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I wrote: > While this is sufficient to make the problem go away, I'm > inclined to apply both changesets. Even if it accidentally > works right now to have later backrefs consult the outer s/s2 > state pair rather than the original pair, that seems far too > convoluted and bug-prone. The outer states should be strictly > the concern of the iteration setup logic in the outer invocation > of parseqatom. > (I'm sort of wondering now whether the outer s/s2 states are > even really necessary anymore ... maybe Spencer put those in > as a way of preventing some prehistoric version of this bug. > But I'm not excited about messing with that right now.) I realized that the earlier patch is actually a bad idea, because it breaks the possibility of updating the subre to mark it as being referenced by a later backref, as the REG_NOSUB patch needs to do. However, on closer study, the outer s/s2 states being added by the "prepare a general-purpose state skeleton" stanza really are duplicative of the ones we already made for a parenthesized atom, so we can just get rid of them. Done that way. regards, tom lane