| From: | Lakshmi N <lakshmin(dot)jhs(at)gmail(dot)com> |
|---|---|
| To: | "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Fix pg_upgrade to detect invalid logical replication slots on PG19 |
| Date: | 2026-04-20 08:57:43 |
| Message-ID: | CA+3i_M8eT6j8_cBHkYykV-SXCxbmAxpVSKptjDVq+MFtpT-Paw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi Hackers,
The PG19-optimized slot catchup query uses a CTE that filters on
invalidation_reason IS NULL, then cross-joins it with the main slot
query. When ALL logical slots in a database are invalid, the CTE
returns zero rows, and the cross join produces an empty result set.
This causes pg_upgrade to silently skip those slots entirely --
neither detecting them as invalid (which should block the upgrade)
nor attempting to migrate them.
The pre-PG19 query path does not have this problem because it queries
pg_replication_slots directly without a cross join. This may not impact
upgrade to PG19 but will change the behavior for PG20 upgrade.
Fix by changing the cross join to a LEFT JOIN,
so that invalid slots still appear in the result set with NULL
caught_up values.
Regards,
Lakshmi
| Attachment | Content-Type | Size |
|---|---|---|
| 0001-Fix-pg_upgrade-to-detect-invalid-logical-replication.patch | application/octet-stream | 965 bytes |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bruce Momjian | 2026-04-20 09:10:54 | Re: First draft of PG 19 release notes |
| Previous Message | Ayush Tiwari | 2026-04-20 08:54:47 | Re: [PATCH] Reject ENCODING option for COPY TO FORMAT JSON |