summaryrefslogtreecommitdiff
path: root/tests/postgres_tests
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2023-03-28 00:13:00 -0400
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2024-07-03 16:36:25 +0200
commit65ad4ade74dc9208b9d686a451cd6045df0c9c3a (patch)
tree641c0c1e6264a3f23212ee383b46c25fd4d0f0a1 /tests/postgres_tests
parent2e47dde438d689199934bca0967152a3b0e8a95f (diff)
Refs #28900 -- Made SELECT respect the order specified by values(*selected).
Previously the order was always extra_fields + model_fields + annotations with respective local ordering inferred from the insertion order of *selected. This commits introduces a new `Query.selected` propery that keeps tracks of the global select order as specified by on values assignment. This is crucial feature to allow the combination of queries mixing annotations and table references. It also allows the removal of the re-ordering shenanigans perform by ValuesListIterable in order to re-map the tuples returned from the database backend to the order specified by values_list() as they'll be in the right order at query compilation time. Refs #28553 as the initially reported issue that was only partially fixed for annotations by d6b6e5d0fd4e6b6d0183b4cf6e4bd4f9afc7bf67. Thanks Mariusz Felisiak and Sarah Boyce for review.
Diffstat (limited to 'tests/postgres_tests')
-rw-r--r--tests/postgres_tests/test_array.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/postgres_tests/test_array.py b/tests/postgres_tests/test_array.py
index 386a0afa3a..ff0c4aabb1 100644
--- a/tests/postgres_tests/test_array.py
+++ b/tests/postgres_tests/test_array.py
@@ -466,8 +466,8 @@ class TestQuerying(PostgreSQLTestCase):
],
)
sql = ctx[0]["sql"]
- self.assertIn("GROUP BY 2", sql)
- self.assertIn("ORDER BY 2", sql)
+ self.assertIn("GROUP BY 1", sql)
+ self.assertIn("ORDER BY 1", sql)
def test_order_by_arrayagg_index(self):
qs = (