aboutsummaryrefslogtreecommitdiff
path: root/contrib/postgres_fdw/option.c
diff options
context:
space:
mode:
authorFujii Masao <fujii@postgresql.org>2021-04-02 19:45:42 +0900
committerFujii Masao <fujii@postgresql.org>2021-04-02 19:45:42 +0900
commitb1be3074ac719ce8073fba35d4c8b52fb4ddd0c3 (patch)
tree4a7b836541eb0d7df10a6b83e951c7f9f673cc3e /contrib/postgres_fdw/option.c
parent9c5f67fd6256246b2a788a8feb1d42b79dcd0448 (diff)
downloadpostgresql-b1be3074ac719ce8073fba35d4c8b52fb4ddd0c3.tar.gz
postgresql-b1be3074ac719ce8073fba35d4c8b52fb4ddd0c3.zip
postgres_fdw: Add option to control whether to keep connections open.
This commit adds a new option keep_connections that controls whether postgres_fdw keeps the connections to the foreign server open so that the subsequent queries can re-use them. This option can only be specified for a foreign server. The default is on. If set to off, all connections to the foreign server will be discarded at the end of transaction. Closed connections will be re-established when they are necessary by future queries using a foreign table. This option is useful, for example, when users want to prevent the connections from eating up the foreign servers connections capacity. Author: Bharath Rupireddy Reviewed-by: Alexey Kondratov, Vignesh C, Fujii Masao Discussion: https://postgr.es/m/CALj2ACVvrp5=AVp2PupEm+nAC8S4buqR3fJMmaCoc7ftT0aD2A@mail.gmail.com
Diffstat (limited to 'contrib/postgres_fdw/option.c')
-rw-r--r--contrib/postgres_fdw/option.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/contrib/postgres_fdw/option.c b/contrib/postgres_fdw/option.c
index 530d7a66d40..f1d0c8bd412 100644
--- a/contrib/postgres_fdw/option.c
+++ b/contrib/postgres_fdw/option.c
@@ -108,7 +108,8 @@ postgres_fdw_validator(PG_FUNCTION_ARGS)
*/
if (strcmp(def->defname, "use_remote_estimate") == 0 ||
strcmp(def->defname, "updatable") == 0 ||
- strcmp(def->defname, "async_capable") == 0)
+ strcmp(def->defname, "async_capable") == 0 ||
+ strcmp(def->defname, "keep_connections") == 0)
{
/* these accept only boolean values */
(void) defGetBoolean(def);
@@ -221,6 +222,7 @@ InitPgFdwOptions(void)
/* async_capable is available on both server and table */
{"async_capable", ForeignServerRelationId, false},
{"async_capable", ForeignTableRelationId, false},
+ {"keep_connections", ForeignServerRelationId, false},
{"password_required", UserMappingRelationId, false},
/*