From 141873f86d299a7c8469392367b820960d01707a Mon Sep 17 00:00:00 2001 From: Andy Schoenberger Date: Tue, 3 Jan 2023 16:52:31 -0500 Subject: Add config option to always run with a single connection (#1386) Co-authored-by: Irina Truong --- changelog.rst | 1 + pgcli/main.py | 3 +++ pgcli/pgclirc | 4 ++++ 3 files changed, 8 insertions(+) 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 -- cgit v1.2.3