Skip to content

Commit

Permalink
Supported native aggregation over INTERVALs on Oracle 23c.
Browse files Browse the repository at this point in the history
  • Loading branch information
ngnpope authored and felixxm committed Jan 1, 2024
1 parent 39a00f3 commit a816efe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions django/db/backends/oracle/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,7 @@ def supports_frame_exclusion(self):
@cached_property
def supports_boolean_expr_in_select_clause(self):
return self.connection.oracle_version >= (23,)

@cached_property
def supports_aggregation_over_interval_types(self):
return self.connection.oracle_version >= (23,)
5 changes: 4 additions & 1 deletion django/db/models/functions/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ def as_mysql(self, compiler, connection, **extra_context):
return sql, params

def as_oracle(self, compiler, connection, **extra_context):
if self.output_field.get_internal_type() == "DurationField":
if (
self.output_field.get_internal_type() == "DurationField"
and not connection.features.supports_aggregation_over_interval_types
):
expression = self.get_source_expressions()[0]
options = self._get_repr_options()
from django.db.backends.oracle.functions import (
Expand Down

0 comments on commit a816efe

Please sign in to comment.