pgsql: pg_upgrade: Fix detection of invalid logical replication slots.

From: Masahiko Sawada <msawada(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: pg_upgrade: Fix detection of invalid logical replication slots.
Date: 2026-04-22 17:00:24
Message-ID: E1wFaw3-002Bp9-1x@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

pg_upgrade: Fix detection of invalid logical replication slots.

Commit 7a1f0f8747a optimized the slot verification query but
overlooked cases where all logical replication slots are already
invalidated. In this scenario, the CTE returns no rows, causing the
main query (which used a cross join) to return an empty result even
when invalid slots exist.

This commit fixes this by using a LEFT JOIN with the CTE, ensuring
that slots are properly reported even if the CTE returns no rows.

Author: Lakshmi N <lakshmin(dot)jhs(at)gmail(dot)com>
Reviewed-by: Shveta Malik <shveta(dot)malik(at)gmail(dot)com>
Reviewed-by: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Discussion: https://postgr.es/m/CA+3i_M8eT6j8_cBHkYykV-SXCxbmAxpVSKptjDVq+MFtpT-Paw@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/e471dc59121932d669d69d0683c71d5df3b527e3

Modified Files
--------------
src/bin/pg_upgrade/info.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Jeff Davis 2026-04-22 17:27:30 pgsql: catcache.c: use C_COLLATION_OID for texteqfast/texthashfast.
Previous Message Peter Geoghegan 2026-04-22 16:47:33 pgsql: Harmonize function parameter names for Postgres 19.