From 3e3e8141662c70d74d3aaef9d4b053c9636ea0d7 Mon Sep 17 00:00:00 2001 From: Jarrett Keifer Date: Sun, 17 Jul 2022 21:30:20 -0700 Subject: [PATCH] Fixed #33854 -- Corrected the order of parameters in dbshell on PostgreSQL. --- django/db/backends/postgresql/client.py | 2 +- tests/dbshell/test_postgresql.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/django/db/backends/postgresql/client.py b/django/db/backends/postgresql/client.py index 4c9bd63546..3b5ddafaca 100644 --- a/django/db/backends/postgresql/client.py +++ b/django/db/backends/postgresql/client.py @@ -32,9 +32,9 @@ class DatabaseClient(BaseDatabaseClient): args += ["-h", host] if port: args += ["-p", str(port)] + args.extend(parameters) if dbname: args += [dbname] - args.extend(parameters) env = {} if passwd: diff --git a/tests/dbshell/test_postgresql.py b/tests/dbshell/test_postgresql.py index 02924d0bcc..53dedaca01 100644 --- a/tests/dbshell/test_postgresql.py +++ b/tests/dbshell/test_postgresql.py @@ -154,7 +154,7 @@ class PostgreSqlDbshellCommandTestCase(SimpleTestCase): def test_parameters(self): self.assertEqual( self.settings_to_cmd_args_env({"NAME": "dbname"}, ["--help"]), - (["psql", "dbname", "--help"], None), + (["psql", "--help", "dbname"], None), ) @skipUnless(connection.vendor == "postgresql", "Requires a PostgreSQL connection")