Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rdZcI-006Ik1-HE for pgsql-bugs@arkaria.postgresql.org; Fri, 23 Feb 2024 17:45:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rdZcG-002UDr-B1 for pgsql-bugs@arkaria.postgresql.org; Fri, 23 Feb 2024 17:45:44 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rdZcG-002UDj-2l for pgsql-bugs@lists.postgresql.org; Fri, 23 Feb 2024 17:45:44 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rdZcD-000YZi-RZ for pgsql-bugs@lists.postgresql.org; Fri, 23 Feb 2024 17:45:43 +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 41NHjdgq831848; Fri, 23 Feb 2024 12:45:39 -0500 From: Tom Lane To: exclusion@gmail.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18360: Invalid memory access occurs when using geqo In-reply-to: <18360-a23caf3157f34e62@postgresql.org> References: <18360-a23caf3157f34e62@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Fri, 23 Feb 2024 13:00:01 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <831846.1708710339.1@sss.pgh.pa.us> Date: Fri, 23 Feb 2024 12:45:39 -0500 Message-ID: <831847.1708710339@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Bug reporting form writes: > The following script: > SET enable_partitionwise_join = on; > SET geqo_threshold = 2; > CREATE TABLE t (i int) PARTITION BY LIST (i); > CREATE TABLE tp1 PARTITION OF t FOR VALUES IN (1); > SELECT t1.* FROM t t1 WHERE EXISTS (SELECT 1 FROM t t2 WHERE t1.i = t2.i); > leads to a server crash with the following stack trace: Yup, reproduces here. > It looks like uniq_exprs points to memory located in a short-lived context > created in geqo_eval(). Indeed. Curiously, the in_operators list, which I thought was parallel to that, seems fine. Anyway, something's being careless about which context it creates that data structure in. Shouldn't be too hard to fix. I wonder whether we need a debugging mode that frees path detritus under the same rules as GEQO does, even for single-relation queries. This sort of problem can escape notice for a long time. regards, tom lane