pgsql: postgres_fdw: Fix connection leak.

2020-12-28 Thread Fujii Masao
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,

pgsql: postgres_fdw: Fix connection leak.

2020-12-28 Thread Fujii Masao
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,

pgsql: postgres_fdw: Fix connection leak.

2020-12-28 Thread Fujii Masao
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,

pgsql: postgres_fdw: Fix connection leak.

2020-12-28 Thread Fujii Masao
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,

pgsql: postgres_fdw: Fix connection leak.

2020-12-28 Thread Fujii Masao
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,

pgsql: postgres_fdw: Fix connection leak.

2020-12-28 Thread Fujii Masao
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,

pgsql: postgres_fdw: Fix connection leak.

2020-12-28 Thread Fujii Masao
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,

pgsql: Fix inconsistent code with shared invalidations of snapshots

2020-12-28 Thread Michael Paquier
Fix inconsistent code with shared invalidations of snapshots The code in charge of processing a single invalidation message has been using since 568d413 the structure for relation mapping messages. This had fortunately no consequence as both locate the database ID at the same location, but it cou

pgsql: Fix inconsistent code with shared invalidations of snapshots

2020-12-28 Thread Michael Paquier
Fix inconsistent code with shared invalidations of snapshots The code in charge of processing a single invalidation message has been using since 568d413 the structure for relation mapping messages. This had fortunately no consequence as both locate the database ID at the same location, but it cou

pgsql: Fix inconsistent code with shared invalidations of snapshots

2020-12-28 Thread Michael Paquier
Fix inconsistent code with shared invalidations of snapshots The code in charge of processing a single invalidation message has been using since 568d413 the structure for relation mapping messages. This had fortunately no consequence as both locate the database ID at the same location, but it cou

pgsql: Fix inconsistent code with shared invalidations of snapshots

2020-12-28 Thread Michael Paquier
Fix inconsistent code with shared invalidations of snapshots The code in charge of processing a single invalidation message has been using since 568d413 the structure for relation mapping messages. This had fortunately no consequence as both locate the database ID at the same location, but it cou

pgsql: Fix inconsistent code with shared invalidations of snapshots

2020-12-28 Thread Michael Paquier
Fix inconsistent code with shared invalidations of snapshots The code in charge of processing a single invalidation message has been using since 568d413 the structure for relation mapping messages. This had fortunately no consequence as both locate the database ID at the same location, but it cou

pgsql: Fix inconsistent code with shared invalidations of snapshots

2020-12-28 Thread Michael Paquier
Fix inconsistent code with shared invalidations of snapshots The code in charge of processing a single invalidation message has been using since 568d413 the structure for relation mapping messages. This had fortunately no consequence as both locate the database ID at the same location, but it cou

pgsql: Fix inconsistent code with shared invalidations of snapshots

2020-12-28 Thread Michael Paquier
Fix inconsistent code with shared invalidations of snapshots The code in charge of processing a single invalidation message has been using since 568d413 the structure for relation mapping messages. This had fortunately no consequence as both locate the database ID at the same location, but it cou

Re: pgsql: Add pg_alterckey utility to change the cluster key

2020-12-28 Thread Andrew Dunstan
On 12/27/20 12:44 PM, Bruce Momjian wrote: > >> Based on the number of concerns raised by various people over the last >> couple of days (including myself, one point being the refactoring of >> the ciphers taken from pgcrypto that should have been in its own >> commit), I agree that it would be b

Re: pgsql: Add pg_alterckey utility to change the cluster key

2020-12-28 Thread Fabien COELHO
Hello Bruce, I put the thread back on hackers. The first two keys are stored in pg_cryptokeys/ in the data directory, while the third one is retrieved using a GUC for validation at server startup for the other two. Do we necessarily have to store the first level keys within the data directo

Re: pgsql: Add pg_alterckey utility to change the cluster key

2020-12-28 Thread Bruce Momjian
On Mon, Dec 28, 2020 at 08:49:09AM -0500, Andrew Dunstan wrote: > > On 12/27/20 12:44 PM, Bruce Momjian wrote: > > > >> Based on the number of concerns raised by various people over the last > >> couple of days (including myself, one point being the refactoring of > >> the ciphers taken from pgcry

Re: pgsql: Add pg_alterckey utility to change the cluster key

2020-12-28 Thread Bruce Momjian
On Mon, Dec 28, 2020 at 10:09:11AM -0400, Fabien COELHO wrote: > Yep, my point is that it should be possible to have the whole key management > outside of postgres. I think this kind of discussion has to happen in a different thread, parhsps: https://www.postgresql.org/message-id/flat/20

pgsql: Fix thinko in plpgsql memory leak fix.

2020-12-28 Thread Tom Lane
Fix thinko in plpgsql memory leak fix. Commit a6b1f5365 intended to place the transient "target" list of a CALL statement in the function's statement-lifespan context, but I fat-fingered that and used get_eval_mcontext() instead of get_stmt_mcontext(). The eval_mcontext belongs to the "simple exp

pgsql: Fix thinko in plpgsql memory leak fix.

2020-12-28 Thread Tom Lane
Fix thinko in plpgsql memory leak fix. Commit a6b1f5365 intended to place the transient "target" list of a CALL statement in the function's statement-lifespan context, but I fat-fingered that and used get_eval_mcontext() instead of get_stmt_mcontext(). The eval_mcontext belongs to the "simple exp

pgsql: Fix thinko in plpgsql memory leak fix.

2020-12-28 Thread Tom Lane
Fix thinko in plpgsql memory leak fix. Commit a6b1f5365 intended to place the transient "target" list of a CALL statement in the function's statement-lifespan context, but I fat-fingered that and used get_eval_mcontext() instead of get_stmt_mcontext(). The eval_mcontext belongs to the "simple exp

pgsql: Fix thinko in plpgsql memory leak fix.

2020-12-28 Thread Tom Lane
Fix thinko in plpgsql memory leak fix. Commit a6b1f5365 intended to place the transient "target" list of a CALL statement in the function's statement-lifespan context, but I fat-fingered that and used get_eval_mcontext() instead of get_stmt_mcontext(). The eval_mcontext belongs to the "simple exp

pgsql: Further fix thinko in plpgsql memory leak fix.

2020-12-28 Thread Tom Lane
Further fix thinko in plpgsql memory leak fix. There's a second call of get_eval_mcontext() that should also be get_stmt_mcontext(). This is actually dead code, since no interesting allocations happen before switching back to the original context, but we should keep it in sync with the other call

pgsql: Further fix thinko in plpgsql memory leak fix.

2020-12-28 Thread Tom Lane
Further fix thinko in plpgsql memory leak fix. There's a second call of get_eval_mcontext() that should also be get_stmt_mcontext(). This is actually dead code, since no interesting allocations happen before switching back to the original context, but we should keep it in sync with the other call

pgsql: Further fix thinko in plpgsql memory leak fix.

2020-12-28 Thread Tom Lane
Further fix thinko in plpgsql memory leak fix. There's a second call of get_eval_mcontext() that should also be get_stmt_mcontext(). This is actually dead code, since no interesting allocations happen before switching back to the original context, but we should keep it in sync with the other call

pgsql: Further fix thinko in plpgsql memory leak fix.

2020-12-28 Thread Tom Lane
Further fix thinko in plpgsql memory leak fix. There's a second call of get_eval_mcontext() that should also be get_stmt_mcontext(). This is actually dead code, since no interesting allocations happen before switching back to the original context, but we should keep it in sync with the other call

pgsql: Expose the default for channel_binding in PQconndefaults().

2020-12-28 Thread Tom Lane
Expose the default for channel_binding in PQconndefaults(). If there's a static default value for a connection option, it should be shown in the PQconninfoOptions array. Daniele Varrazzo Discussion: https://postgr.es/m/ca+mi_8zo8rgn7p+6zry7qddu+23ukt9avohnypbgkacxwgg...@mail.gmail.com Branch -

pgsql: Expose the default for channel_binding in PQconndefaults().

2020-12-28 Thread Tom Lane
Expose the default for channel_binding in PQconndefaults(). If there's a static default value for a connection option, it should be shown in the PQconninfoOptions array. Daniele Varrazzo Discussion: https://postgr.es/m/ca+mi_8zo8rgn7p+6zry7qddu+23ukt9avohnypbgkacxwgg...@mail.gmail.com Branch -

pgsql: Fix bugs in libpq's GSSAPI encryption support.

2020-12-28 Thread Tom Lane
Fix bugs in libpq's GSSAPI encryption support. The critical issue fixed here is that if a GSSAPI-encrypted connection is successfully made, pqsecure_open_gss() cleared conn->allow_ssl_try, as an admittedly-hacky way of preventing us from then trying to tunnel SSL encryption over the already-encryp

pgsql: Fix bugs in libpq's GSSAPI encryption support.

2020-12-28 Thread Tom Lane
Fix bugs in libpq's GSSAPI encryption support. The critical issue fixed here is that if a GSSAPI-encrypted connection is successfully made, pqsecure_open_gss() cleared conn->allow_ssl_try, as an admittedly-hacky way of preventing us from then trying to tunnel SSL encryption over the already-encryp

pgsql: Fix bugs in libpq's GSSAPI encryption support.

2020-12-28 Thread Tom Lane
Fix bugs in libpq's GSSAPI encryption support. The critical issue fixed here is that if a GSSAPI-encrypted connection is successfully made, pqsecure_open_gss() cleared conn->allow_ssl_try, as an admittedly-hacky way of preventing us from then trying to tunnel SSL encryption over the already-encryp

pgsql: Improve log messages related to pg_hba.conf not matching a conne

2020-12-28 Thread Tom Lane
Improve log messages related to pg_hba.conf not matching a connection. Include details on whether GSS encryption has been activated; since we added "hostgssenc" type HBA entries, that's relevant info. Kyotaro Horiguchi and Tom Lane. Back-patch to v12 where GSS encryption was introduced. Discuss

pgsql: Fix assorted issues in backend's GSSAPI encryption support.

2020-12-28 Thread Tom Lane
Fix assorted issues in backend's GSSAPI encryption support. Unrecoverable errors detected by GSSAPI encryption can't just be reported with elog(ERROR) or elog(FATAL), because attempting to send the error report to the client is likely to lead to infinite recursion or loss of protocol sync. Instea

pgsql: Improve log messages related to pg_hba.conf not matching a conne

2020-12-28 Thread Tom Lane
Improve log messages related to pg_hba.conf not matching a connection. Include details on whether GSS encryption has been activated; since we added "hostgssenc" type HBA entries, that's relevant info. Kyotaro Horiguchi and Tom Lane. Back-patch to v12 where GSS encryption was introduced. Discuss

pgsql: Fix assorted issues in backend's GSSAPI encryption support.

2020-12-28 Thread Tom Lane
Fix assorted issues in backend's GSSAPI encryption support. Unrecoverable errors detected by GSSAPI encryption can't just be reported with elog(ERROR) or elog(FATAL), because attempting to send the error report to the client is likely to lead to infinite recursion or loss of protocol sync. Instea

pgsql: Improve log messages related to pg_hba.conf not matching a conne

2020-12-28 Thread Tom Lane
Improve log messages related to pg_hba.conf not matching a connection. Include details on whether GSS encryption has been activated; since we added "hostgssenc" type HBA entries, that's relevant info. Kyotaro Horiguchi and Tom Lane. Back-patch to v12 where GSS encryption was introduced. Discuss

pgsql: Fix assorted issues in backend's GSSAPI encryption support.

2020-12-28 Thread Tom Lane
Fix assorted issues in backend's GSSAPI encryption support. Unrecoverable errors detected by GSSAPI encryption can't just be reported with elog(ERROR) or elog(FATAL), because attempting to send the error report to the client is likely to lead to infinite recursion or loss of protocol sync. Instea