diff options
author | Simon Charette <charette.s@gmail.com> | 2020-01-02 11:33:01 -0500 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-01-03 10:35:08 +0100 |
commit | 9bcbcd599abac91ea853b2fe10b784ba32df043e (patch) | |
tree | aede04abf962e71b9e93c6628176aad75f895fa8 /django/db/backends/postgresql/operations.py | |
parent | 372eaa395f167c038e546c6be554c96014d40109 (diff) | |
download | django-9bcbcd599abac91ea853b2fe10b784ba32df043e.tar.gz |
Fixed #31133 -- Fixed crash when subtracting against a subquery annotation.
The subtract_temporals() database operation was not handling expressions
returning SQL params in mixed database types.
Regression in 35431298226165986ad07e91f9d3aca721ff38ec.
Thanks Reupen Shah for the report.
Diffstat (limited to 'django/db/backends/postgresql/operations.py')
-rw-r--r-- | django/db/backends/postgresql/operations.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/django/db/backends/postgresql/operations.py b/django/db/backends/postgresql/operations.py index 56e1331f75..ee7787c560 100644 --- a/django/db/backends/postgresql/operations.py +++ b/django/db/backends/postgresql/operations.py @@ -271,7 +271,8 @@ class DatabaseOperations(BaseDatabaseOperations): if internal_type == 'DateField': lhs_sql, lhs_params = lhs rhs_sql, rhs_params = rhs - return "(interval '1 day' * (%s - %s))" % (lhs_sql, rhs_sql), lhs_params + rhs_params + params = (*lhs_params, *rhs_params) + return "(interval '1 day' * (%s - %s))" % (lhs_sql, rhs_sql), params return super().subtract_temporals(internal_type, lhs, rhs) def window_frame_range_start_end(self, start=None, end=None): |