Skip to content

django: annotating DateTimeField + DurationField crashes #202

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
timgraham opened this issue Dec 16, 2019 · 0 comments
Closed

django: annotating DateTimeField + DurationField crashes #202

timgraham opened this issue Dec 16, 2019 · 0 comments
Assignees
Labels
django-test-suite 🚨 This issue needs some love. triage me I really want to be triaged.

Comments

@timgraham
Copy link
Contributor

======================================================================
ERROR: test_mixed_type_annotation_date_interval (annotations.tests.NonAggregateAnnotationTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/tim/code/django/tests/annotations/tests.py", line 137, in test_mixed_type_annotation_date_interval
    expires=ExpressionWrapper(F('active_at') + F('duration'), output_field=DateTimeField())
  File "/home/tim/code/django/django/db/models/query.py", line 653, in first
    for obj in (self if self.ordered else self.order_by('pk'))[:1]:
  File "/home/tim/code/django/django/db/models/query.py", line 274, in __iter__
    self._fetch_all()
  File "/home/tim/code/django/django/db/models/query.py", line 1242, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "/home/tim/code/django/django/db/models/query.py", line 55, in __iter__
    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
  File "/home/tim/code/django/django/db/models/sql/compiler.py", line 1120, in execute_sql
    sql, params = self.as_sql()
  File "/home/tim/code/django/django/db/models/sql/compiler.py", line 474, in as_sql
    extra_select, order_by, group_by = self.pre_sql_setup()
  File "/home/tim/code/django/django/db/models/sql/compiler.py", line 54, in pre_sql_setup
    self.setup_query()
  File "/home/tim/code/django/django/db/models/sql/compiler.py", line 45, in setup_query
    self.select, self.klass_info, self.annotation_col_map = self.get_select()
  File "/home/tim/code/django/django/db/models/sql/compiler.py", line 254, in get_select
    sql, params = self.compile(col, select_format=True)
  File "/home/tim/code/django/django/db/models/sql/compiler.py", line 405, in compile
    sql, params = node.as_sql(self, self.connection)
  File "/home/tim/code/django/django/db/models/expressions.py", line 853, in as_sql
    return self.expression.as_sql(compiler, connection)
  File "/home/tim/code/django/django/db/models/expressions.py", line 428, in as_sql
    return DurationExpression(self.lhs, self.connector, self.rhs).as_sql(compiler, connection)
  File "/home/tim/code/django/django/db/models/expressions.py", line 474, in as_sql
    sql, params = self.compile(self.rhs, compiler, connection)
  File "/home/tim/code/django/django/db/models/expressions.py", line 464, in compile
    return connection.ops.format_for_duration_arithmetic(sql), params
AttributeError: 'DatabaseOperations' object has no attribute 'format_for_duration_arithmetic'
@timgraham timgraham self-assigned this Dec 17, 2019
@yoshi-automation yoshi-automation added 🚨 This issue needs some love. triage me I really want to be triaged. labels Apr 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
django-test-suite 🚨 This issue needs some love. triage me I really want to be triaged.
Projects
None yet
Development

No branches or pull requests

2 participants