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 1lFIQf-0007k2-P5 for pgsql-bugs@arkaria.postgresql.org; Thu, 25 Feb 2021 15:19:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lFIQe-0005NY-1v for pgsql-bugs@arkaria.postgresql.org; Thu, 25 Feb 2021 15:19:48 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lFIQd-0005NR-SH for pgsql-bugs@lists.postgresql.org; Thu, 25 Feb 2021 15:19:47 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lFIQb-00028m-NN for pgsql-bugs@lists.postgresql.org; Thu, 25 Feb 2021 15:19:46 +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 11PFJh0V119551; Thu, 25 Feb 2021 10:19:43 -0500 From: Tom Lane To: Michael Paquier cc: Alexander Lakhin , pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16801: Invalid memory access on WITH RECURSIVE with nested WITHs In-reply-to: References: <16801-393c7922143eaa4d@postgresql.org> <4057243.1614179963@sss.pgh.pa.us> <31724.1614213386@sss.pgh.pa.us> <51877.1614219226@sss.pgh.pa.us> <60272.1614221283@sss.pgh.pa.us> Comments: In-reply-to Michael Paquier message dated "Thu, 25 Feb 2021 12:12:07 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <119549.1614266383.1@sss.pgh.pa.us> Date: Thu, 25 Feb 2021 10:19:43 -0500 Message-ID: <119550.1614266383@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Michael Paquier writes: > On Wed, Feb 24, 2021 at 09:48:03PM -0500, Tom Lane wrote: >> Anyway, I think we're better off with a test that doesn't require >> DEBUG_LIST_MEMORY_USAGE, or preferably not even CLOBBER_FREED_MEMORY, >> to show the problem. The test I showed misbehaves even in non-debug >> builds, because it actually depends on what's in the innerwiths lists. > Yeah. What I sent previously does not break in non-debug builds, but > it does with just --enable-cassert. > Hmm. I'd like to think that this would be enough for this thread, and > I cannot come up now with a test able to break the lists for non-debug > builds. But perhaps you have an idea? For me, the example I gave fails in a non-debug build. With the code as of HEAD, I get "ERROR: stack depth limit exceeded" or a segfault. With your patch applied, it complains about w6 not having the correct form for a recursive CTE. regards, tom lane