agora inbox for pgsql-bugs@postgresql.org  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: syzhong16@gmail.com
Subject: BUG #19626: Segmentation fault planning self-join IN subquery with LATERAL UNION ALL
Date: Tue, 18 Aug 2026 03:06:09 +0000
Message-ID: <19626-f1b794ea5ad205e9@postgresql.org> (raw)

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:        

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.








view thread (9+ messages)  latest in thread

Message-ID: <19626-f1b794ea5ad205e9@postgresql.org>
Permalink:  ../19626-f1b794ea5ad205e9@postgresql.org/
Also on:    postgresql.org/message-id/19626-f1b794ea5ad205e9@postgresql.org

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, syzhong16@gmail.com
  Subject: Re: BUG #19626: Segmentation fault planning self-join IN subquery with LATERAL UNION ALL
  In-Reply-To: <19626-f1b794ea5ad205e9@postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox