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.96) (envelope-from ) id 1wwIlh-001tS0-06 for pgsql-bugs@arkaria.postgresql.org; Tue, 18 Aug 2026 12:18:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wwIle-00FY6w-37 for pgsql-bugs@arkaria.postgresql.org; Tue, 18 Aug 2026 12:18:12 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wwAAN-00DLXi-1P for pgsql-bugs@lists.postgresql.org; Tue, 18 Aug 2026 03:07:08 +0000 Received: from mahout.postgresql.org ([2001:4800:3e1:1::227]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wwAAL-000000019PQ-2x3U for pgsql-bugs@lists.postgresql.org; Tue, 18 Aug 2026 03:07:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=postgresql.org; s=20171124; h=Message-ID:Date:Reply-To:Cc:From:To:Subject: Content-Transfer-Encoding:MIME-Version:Content-Type:Sender:Content-ID: Content-Description:In-Reply-To:References; bh=88zS6Um1PIYZy3UOeTQ8h17bbVr1rcuow8SnGJZcTWE=; b=zFsfSSLZrGGCFur8uRJKQXQfYA CTjzFfJ/BFKjImaXYOzmgkv6otUGr6zQdhkC/sQ3WzUgl3pVCW9pI5ms3C2KVs0wSQgdvlREb8UOU jJGWZSdfKtsqUblF9j/A/8FM8l4SNWCFB9GWCBivBmXrndner4qGwlJcszh+U18+VquO8R2fCS0Kc OesFdoPhrGQ+w2Dbw9eaJmZUjSC5RDrURp8Qtjbwu8DBsKTFmRMyf8EsXnqcjPKmV2iQHdyWNrmo5 PtZbA2QN6eIZDhUk1OCYloSwAxxafDyc06Rk+46RHjVvHtApZKXh2ACZoeaSFoaHOwb4rodKuPfyN 8DUs6ezA==; Received: from wrigleys.postgresql.org ([2a02:16a8:dc51::60]) by mahout.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wwAAL-003WuM-0z for pgsql-bugs@lists.postgresql.org; Tue, 18 Aug 2026 03:07:05 +0000 Received: from localhost ([127.0.0.1] helo=wrigleys.postgresql.org) by wrigleys.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1wwAAJ-00000009Ibf-21RX for pgsql-bugs@lists.postgresql.org; Tue, 18 Aug 2026 03:07:03 +0000 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #19626: Segmentation fault planning self-join IN subquery with LATERAL UNION ALL To: pgsql-bugs@lists.postgresql.org From: PG Bug reporting form Cc: syzhong16@gmail.com Reply-To: syzhong16@gmail.com, pgsql-bugs@lists.postgresql.org Date: Tue, 18 Aug 2026 03:06:09 +0000 Message-ID: <19626-f1b794ea5ad205e9@postgresql.org> X-Auto-Response-Suppress: All Auto-Submitted: auto-generated List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk The following bug has been logged on the website: Bug reference: 19626 Logged by: Suyang Zhong Email address: syzhong16@gmail.com PostgreSQL version: 19beta3 Operating system: Ubuntu 22.04 Description: =20 Hi, The following test case caused a segmentation fault. ``` CREATE TABLE t0(c2 INT PRIMARY KEY, c3 INT); SELECT count(*) FROM t0 INNER JOIN LATERAL (SELECT t0.c3 UNION ALL SELECT t0.c3) AS s ON (s.c3 IS NOT NULL) WHERE t0.c2 IN (SELECT c2 FROM t0); -- server closed the connection unexpectedly ``` Here's the log on the server side. ``` 2026-08-18 02:50:27.936 UTC [530] STATEMENT: CREATE TABLE t0(c2 INT PRIMARY KEY, c3 INT); 2026-08-18 02:50:32.126 UTC [1] LOG: client backend (PID 530) was terminated by signal 11: Segmentation fault 2026-08-18 02:50:32.126 UTC [1] DETAIL: Failed process was running: SELECT count(*) FROM t0 INNER JOIN LATERAL (SELECT t0.c3 UNION ALL SELECT t0.c3) AS s ON (s.c3 IS NOT NULL) WHERE t0.c2 IN (SELECT c2 FROM t0); 2026-08-18 02:50:32.126 UTC [1] LOG: terminating any other active server processes 2026-08-18 02:50:32.128 UTC [1] LOG: all server processes terminated; reinitializing 2026-08-18 02:50:32.143 UTC [534] LOG: database system was interrupted; last known up at 2026-08-18 01:27:03 UTC ``` Reproduced on 20devel and 19beta3.