Refs #26608 -- Added a database feature for fixed frame range distance support.

This commit is contained in:
Simon Charette 2019-01-15 22:23:50 -06:00 committed by Tim Graham
parent 64d5bafbc6
commit b8c48d06fa
3 changed files with 3 additions and 2 deletions

View File

@ -239,6 +239,7 @@ class BaseDatabaseFeatures:
# Does the backend support window expressions (expression OVER (...))?
supports_over_clause = False
supports_frame_range_fixed_distance = False
# Does the backend support CAST with precision?
supports_cast_with_precision = True

View File

@ -52,6 +52,7 @@ class DatabaseFeatures(BaseDatabaseFeatures):
"""
supports_callproc_kwargs = True
supports_over_clause = True
supports_frame_range_fixed_distance = True
supports_ignore_conflicts = False
max_query_params = 2**16 - 1
supports_partial_indexes = False

View File

@ -536,8 +536,7 @@ class WindowFunctionTests(TestCase):
('Brown', 53000, 'Sales', datetime.date(2009, 9, 1), 108000),
], transform=lambda row: (row.name, row.salary, row.department, row.hire_date, row.sum))
@skipIf(connection.vendor == 'postgresql', 'n following/preceding not supported by PostgreSQL')
@skipIf(connection.vendor == 'sqlite', 'n following/preceding not supported by SQLite')
@skipUnlessDBFeature('supports_frame_range_fixed_distance')
def test_range_n_preceding_and_following(self):
qs = Employee.objects.annotate(sum=Window(
expression=Sum('salary'),