From 5b884d45ac5b76234eca614d90c83b347294c332 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Tue, 14 Apr 2020 08:56:40 +0100 Subject: Fixed #29501 -- Allowed dbshell to pass options to underlying tool. --- django/db/backends/postgresql/client.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'django/db/backends/postgresql/client.py') 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) -- cgit v1.2.1