summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Schoenberger <akschoenberger@gmail.com>2023-01-03 16:52:31 -0500
committerGitHub <noreply@github.com>2023-01-03 13:52:31 -0800
commit141873f86d299a7c8469392367b820960d01707a (patch)
treea8502f43ff8a6813186795afebe034b6fc9ee206
parent81b0431d80f84ecf86bd311c7e06afe291b965fd (diff)
Add config option to always run with a single connection (#1386)
Co-authored-by: Irina Truong <i.chernyavska@gmail.com>
-rw-r--r--changelog.rst1
-rw-r--r--pgcli/main.py3
-rw-r--r--pgcli/pgclirc4
3 files changed, 8 insertions, 0 deletions
diff --git a/changelog.rst b/changelog.rst
index 0563a7b7..cc441c41 100644
--- a/changelog.rst
+++ b/changelog.rst
@@ -12,6 +12,7 @@ Features:
Also prevents getting stuck in a retry loop.
* Config option to not restart connection when cancelling a `destructive_warning` query. By default,
it will now not restart.
+* Config option to always run with a single connection.
Bug fixes:
----------
diff --git a/pgcli/main.py b/pgcli/main.py
index 8c7d59dc..800816eb 100644
--- a/pgcli/main.py
+++ b/pgcli/main.py
@@ -264,6 +264,9 @@ class PGCli:
# Initialize completer
smart_completion = c["main"].as_bool("smart_completion")
keyword_casing = c["main"]["keyword_casing"]
+ single_connection = single_connection or c["main"].as_bool(
+ "always_use_single_connection"
+ )
self.settings = {
"casing_file": get_casing_file(c),
"generate_casing_file": c["main"].as_bool("generate_casing_file"),
diff --git a/pgcli/pgclirc b/pgcli/pgclirc
index b849adfe..2c92940b 100644
--- a/pgcli/pgclirc
+++ b/pgcli/pgclirc
@@ -9,6 +9,10 @@ smart_completion = True
# visible.)
wider_completion_menu = False
+# Do not create new connections for refreshing completions; Equivalent to
+# always running with the --single-connection flag.
+always_use_single_connection = False
+
# Multi-line mode allows breaking up the sql statements into multiple lines. If
# this is set to True, then the end of the statements must have a semi-colon.
# If this is set to False then sql statements can't be split into multiple