postgresql/contrib/postgres_fdw
Fujii Masao 294cdd7d0f postgres_fdw: Fix connection leak.
In postgres_fdw, the cached connections to foreign servers will not be
closed until the local session exits if the user mappings or foreign servers
that those connections depend on are dropped. Those connections can be
leaked.

To fix that connection leak issue, after a change to a pg_foreign_server
or pg_user_mapping catalog entry, this commit makes postgres_fdw close
the connections depending on that entry immediately if current
transaction has not used those connections yet. Otherwise, mark those
connections as invalid and then close them at the end of current transaction,
since they cannot be closed in the midst of the transaction using them.
Closed connections will be remade at the next opportunity if necessary.

Back-patch to all supported branches.

Author: Bharath Rupireddy
Reviewed-by: Zhihong Yu, Zhijie Hou, Fujii Masao
Discussion: https://postgr.es/m/CALj2ACVNcGH_6qLY-4_tXz8JLvA+4yeBThRfxMz7Oxbk1aHcpQ@mail.gmail.com
2020-12-28 19:59:40 +09:00
..
expected postgres_fdw: Fix connection leak. 2020-12-28 19:59:40 +09:00
sql postgres_fdw: Fix connection leak. 2020-12-28 19:59:40 +09:00
.gitignore Add postgres_fdw contrib module. 2013-02-21 05:27:16 -05:00
connection.c postgres_fdw: Fix connection leak. 2020-12-28 19:59:40 +09:00
deparse.c In postgres_fdw, don't try to ship MULTIEXPR updates to remote server. 2020-01-26 14:31:08 -05:00
Makefile Prevent accidental linking of system-supplied copies of libpq.so etc. 2018-04-03 16:26:05 -04:00
option.c Improve style guideline compliance of assorted error-report messages. 2018-03-22 17:33:10 -04:00
postgres_fdw--1.0.sql Add postgres_fdw contrib module. 2013-02-21 05:27:16 -05:00
postgres_fdw.c postgres_fdw: Account for triggers in non-direct remote UPDATE planning. 2019-06-13 17:59:11 +09:00
postgres_fdw.control Add postgres_fdw contrib module. 2013-02-21 05:27:16 -05:00
postgres_fdw.h Avoid postgres_fdw crash for a targetlist entry that's just a Param. 2019-04-27 13:15:54 -04:00
shippable.c Update copyright for 2018 2018-01-02 23:30:12 -05:00