Fixed #29501 -- Allowed dbshell to pass options to underlying tool.

This commit is contained in:
Adam Johnson 2020-04-14 08:56:40 +01:00
parent 8e8c3f964e
commit 5b884d45ac
13 changed files with 117 additions and 21 deletions

View file

@ -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)