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) <[email protected]> Reviewed-by: Chao Li <[email protected]> Discussion: https://postgr.es/m/os9pr01mb12149b54dea148108c6fa5667f5...@os9pr01mb12149.jpnprd01.prod.outlook.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/702e9dfd6c5001fd64d51c3c47dca2fc953fa9cd Modified Files -------------- src/backend/commands/subscriptioncmds.c | 85 ++++++++++++++++++------------ src/test/regress/expected/subscription.out | 5 +- src/test/regress/sql/subscription.sql | 5 +- 3 files changed, 56 insertions(+), 39 deletions(-)
