Avoid errors during DROP SUBSCRIPTION when slot_name is NONE.
Jeff Davis <jdavis@postgresql.org>
Avoid errors during DROP SUBSCRIPTION when slot_name is NONE. Previously, if the subscription used a server, ForeignServerConnectionString() could raise an error (e.g. missing user mapping) during DROP SUBSCRIPTION even if the conninfo wasn't needed at all. Construct conninfo after the early return, so that if slot_name is NONE and rstates is NIL, the DROP SUBSCRIPTION will succeed even if ForeignServerConnectionString() raises an error (e.g. missing user mapping). If slot_name is NONE and rstates is not NIL, DROP SUBSCRIPTION may still encounter an error from ForeignServerConnectionString(). Reported-by: Hayato Kuroda (Fujitsu) <kuroda.hayato@fujitsu.com> Reviewed-by: Chao Li <li.evan.chao@gmail.com> Discussion: https://postgr.es/m/OS9PR01MB12149B54DEA148108C6FA5667F52D2@OS9PR01MB12149.jpnprd01.prod.outlook.com
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/commands/subscriptioncmds.c | modified | +51 −34 |
| src/test/regress/expected/subscription.out | modified | +3 −2 |
| src/test/regress/sql/subscription.sql | modified | +2 −3 |
Discussion
- Bug in ALTER SUBSCRIPTION ... SERVER / ... CONNECTION with broken old server 26 messages · 2026-04-22 → 2026-07-08