postgresql/src
Alvaro Herrera b40865ebd4
AlterSubscription_refresh: avoid stomping on global variable
This patch replaces use of the global "wrconn" variable in
AlterSubscription_refresh with a local variable of the same name, making
it consistent with other functions in subscriptioncmds.c (e.g.
DropSubscription).

The global wrconn is only meant to be used for logical apply/tablesync worker.
Abusing it this way is known to cause trouble if an apply worker
manages to do a subscription refresh, such as reported by Jeremy Finzel
and diagnosed by Andres Freund back in November 2020, at
https://www.postgresql.org/message-id/20201111215820.qihhrz7fayu6myfi@alap3.anarazel.de

Backpatch to 10.  In branch master, also move the connection establishment
to occur outside the PG_TRY block; this way we can remove a test for NULL in
PG_FINALLY, and it also makes the code more consistent with similar code in
the same file.

Author: Peter Smith <peter.b.smith@fujitsu.com>
Reviewed-by: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>
Discussion: https://postgr.es/m/CAHut+Pu7Jv9L2BOEx_Z0UtJxfDevQSAUW2mJqWU+CtmDrEZVAg@mail.gmail.com
2021-05-07 11:46:37 -04:00
..
backend AlterSubscription_refresh: avoid stomping on global variable 2021-05-07 11:46:37 -04:00
bin Fix some more omissions in pg_upgrade's tests for non-upgradable types. 2021-04-29 15:24:37 -04:00
common Replace use of sys_siglist[] with strsignal(). 2020-07-15 22:05:12 -04:00
fe_utils Fix translation of special characters in psql's LaTeX output modes. 2018-11-26 17:32:51 -05:00
include Redesign the caching done by get_cached_rowtype(). 2021-04-13 13:37:07 -04:00
interfaces Use macro MONTHS_PER_YEAR instead of '12' in /ecpg/pgtypeslib 2021-04-02 16:42:29 -04:00
makefiles Select CFLAGS_SL at configure time, not in platform-specific Makefiles. 2019-10-21 12:32:36 -04:00
pl Redesign the caching done by get_cached_rowtype(). 2021-04-13 13:37:07 -04:00
port pg_attribute_no_sanitize_alignment() macro 2021-02-13 17:49:08 -05:00
template Further tweaking of PG_SYSROOT heuristics for macOS. 2021-01-20 12:07:41 -05:00
test Have ALTER CONSTRAINT recurse on partitioned tables 2021-05-05 12:14:21 -04:00
timezone Update time zone data files to tzdata release 2021a. 2021-01-24 16:29:47 -05:00
tools backpatch "jit: Add support for LLVM 12." 2020-12-07 18:40:27 -08:00
tutorial tutorial: land height is "elevation", not "altitude" 2021-03-10 20:25:18 -05:00
.gitignore
DEVELOPERS
Makefile Fix partial-build problems introduced by having more generated headers. 2018-04-09 16:42:10 -04:00
Makefile.global.in Select CFLAGS_SL at configure time, not in platform-specific Makefiles. 2019-10-21 12:32:36 -04:00
Makefile.shlib Ensure static libraries have correct mod time even if ranlib messes it up. 2018-11-29 15:53:44 -05:00
nls-global.mk nls-global.mk: search build dir for source files, too 2016-06-07 18:55:18 -04:00