diff options
| author | Nick Pope <nick@nickpope.me.uk> | 2023-12-12 17:21:21 +0000 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2024-01-01 10:53:00 +0100 |
| commit | a816efe238eaeb88fd0a53b124c6337bfa60b5a6 (patch) | |
| tree | c6e5fccb52f589d6b60bbd91ac6472f89c05f75c | |
| parent | 39a00f39c55b4dbb6699fbb885b989990a7b5c39 (diff) | |
Supported native aggregation over INTERVALs on Oracle 23c.
https://docs.oracle.com/en/database/oracle/oracle-database/23/nfcoa/application-development.html#GUID-CE5F8EED-934D-458D-B81C-6C8D617F31A2
| -rw-r--r-- | django/db/backends/oracle/features.py | 4 | ||||
| -rw-r--r-- | django/db/models/functions/mixins.py | 5 |
2 files changed, 8 insertions, 1 deletions
diff --git a/django/db/backends/oracle/features.py b/django/db/backends/oracle/features.py index b3531a7cc7..05632bb10e 100644 --- a/django/db/backends/oracle/features.py +++ b/django/db/backends/oracle/features.py @@ -179,3 +179,7 @@ class DatabaseFeatures(BaseDatabaseFeatures): @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,) diff --git a/django/db/models/functions/mixins.py b/django/db/models/functions/mixins.py index caf20e131d..661eee1c13 100644 --- a/django/db/models/functions/mixins.py +++ b/django/db/models/functions/mixins.py @@ -31,7 +31,10 @@ class FixDurationInputMixin: 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 ( |
