diff options
author | Vytis Banaitis <vytis.banaitis@gmail.com> | 2017-02-17 20:34:22 +0200 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2017-02-21 12:06:16 -0500 |
commit | 4045fd56cb0f83d0f78de9aca073c7104e4cf8fd (patch) | |
tree | b2e72f157a082b91a728dc48297f93d00cb2e2e3 /django/db/backends/postgresql/operations.py | |
parent | 5a6f70b4281817656db2f36c5919036d38fcce7f (diff) | |
download | django-4045fd56cb0f83d0f78de9aca073c7104e4cf8fd.tar.gz |
Fixed #27856 -- Improved accuracy of date subtraction on PostgreSQL.
Accuracy was incorrect when dates differ by a month or more.
Diffstat (limited to 'django/db/backends/postgresql/operations.py')
-rw-r--r-- | django/db/backends/postgresql/operations.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/django/db/backends/postgresql/operations.py b/django/db/backends/postgresql/operations.py index 8891612074..463fdc3eda 100644 --- a/django/db/backends/postgresql/operations.py +++ b/django/db/backends/postgresql/operations.py @@ -253,7 +253,7 @@ class DatabaseOperations(BaseDatabaseOperations): if internal_type == 'DateField': lhs_sql, lhs_params = lhs rhs_sql, rhs_params = rhs - return "age(%s, %s)" % (lhs_sql, rhs_sql), lhs_params + rhs_params + return "(interval '1 day' * (%s - %s))" % (lhs_sql, rhs_sql), lhs_params + rhs_params return super().subtract_temporals(internal_type, lhs, rhs) def fulltext_search_sql(self, field_name): |