summaryrefslogtreecommitdiff
path: root/django/db/backends/postgresql/client.py
diff options
context:
space:
mode:
authorAdam Johnson <me@adamj.eu>2020-04-14 08:56:40 +0100
committerAdam Johnson <me@adamj.eu>2020-04-14 14:02:51 +0100
commit5b884d45ac5b76234eca614d90c83b347294c332 (patch)
treeae2fcde4aa7a1fed16661e711dbab785d5b66d89 /django/db/backends/postgresql/client.py
parent8e8c3f964e23e669fc563a74750e51abba4c2e3a (diff)
downloaddjango-5b884d45ac5b76234eca614d90c83b347294c332.tar.gz
Fixed #29501 -- Allowed dbshell to pass options to underlying tool.
Diffstat (limited to 'django/db/backends/postgresql/client.py')
-rw-r--r--django/db/backends/postgresql/client.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/django/db/backends/postgresql/client.py b/django/db/backends/postgresql/client.py
index 0efe0d47f0..9d390b3807 100644
--- a/django/db/backends/postgresql/client.py
+++ b/django/db/backends/postgresql/client.py
@@ -9,7 +9,7 @@ class DatabaseClient(BaseDatabaseClient):
executable_name = 'psql'
@classmethod
- def runshell_db(cls, conn_params):
+ def runshell_db(cls, conn_params, parameters):
args = [cls.executable_name]
host = conn_params.get('host', '')
@@ -29,6 +29,7 @@ class DatabaseClient(BaseDatabaseClient):
if port:
args += ['-p', str(port)]
args += [dbname]
+ args.extend(parameters)
sigint_handler = signal.getsignal(signal.SIGINT)
subprocess_env = os.environ.copy()
@@ -50,5 +51,5 @@ class DatabaseClient(BaseDatabaseClient):
# Restore the original SIGINT handler.
signal.signal(signal.SIGINT, sigint_handler)
- def runshell(self):
- DatabaseClient.runshell_db(self.connection.get_connection_params())
+ def runshell(self, parameters):
+ self.runshell_db(self.connection.get_connection_params(), parameters)