BUG #18852: Unexpected expression in subquery output

PG Bug reporting form <noreply@postgresql.org>

From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: tharakan@gmail.com
Date: 2025-03-16T13:39:16Z
Lists: pgsql-bugs
The following bug has been logged on the website:

Bug reference:      18852
Logged by:          Robins Tharakan
Email address:      tharakan@gmail.com
PostgreSQL version: Unsupported/Unknown
Operating system:   Ubuntu
Description:        

Hi,

The following SQL returns this error:

$ psql -f repro.sql >/dev/null
psql:repro.sql:11: ERROR:  unexpected expression in subquery output

$ cat repro.sql
CREATE SCHEMA a;
CREATE SCHEMA b;
CREATE EXTENSION postgres_fdw ;
CREATE SERVER d FOREIGN DATA WRAPPER postgres_fdw;
CREATE FOREIGN TABLE a.e () SERVER d;
CREATE FOREIGN TABLE a.f (g text) SERVER d;
CREATE FOREIGN TABLE b.h () SERVER d;
SELECT FROM a.f RIGHT JOIN b.h ON EXISTS (SELECT FROM a.e WHERE (SELECT
NULL) > g) LIMIT 9;

- The issue surfaced after commit 824dbea3e41efa3b35094163c834988dea7eb139
[1]
Testing for start crashing
Checking (682c5be25c2~0) - 682c5be25c - fail
Checking (682c5be25c2~10) - 2b73a8cd33 - fail
Checking (682c5be25c2~30) - 3691edfab9 - fail
.
.
Checking (682c5be25c2~3470) - 278eb13c48 - pass
Checking (682c5be25c2~3450) - 7db01fbcef - fail
Checking (682c5be25c2~3460) - 719b342d36 - fail
Checking (682c5be25c2~3465) - c2a465b2c9 - fail
Checking (682c5be25c2~3467) - 7636725b92 - fail
Checking (682c5be25c2~3468) - bfc677c3bc - fail
Checking (682c5be25c2~3469) - 824dbea3e4 - fail
Surfacing Commit is 824dbea3e41efa3b35094163c834988dea7eb139

-
robins

Reference:
1.
https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=824dbea3e41efa3b35094163c834988dea7eb139

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Add support for deparsing semi-joins to contrib/postgres_fdw