summaryrefslogtreecommitdiff
path: root/django/db/backends/postgresql/operations.py
diff options
context:
space:
mode:
authorMads Jensen <mje@inducks.org>2017-09-18 15:42:29 +0200
committerTim Graham <timograham@gmail.com>2017-09-18 09:42:29 -0400
commitd549b8805053d4b064bf492ba90e90db5d7e2a6b (patch)
tree2beee237ae541804ba18367d81e82840745d6e47 /django/db/backends/postgresql/operations.py
parentda1ba03f1dfb303df9bfb5c76d36216e45d05edc (diff)
downloaddjango-d549b8805053d4b064bf492ba90e90db5d7e2a6b.tar.gz
Fixed #26608 -- Added support for window expressions (OVER clause).
Thanks Josh Smeaton, Mariusz Felisiak, Sergey Fedoseev, Simon Charettes, Adam Chainz/Johnson and Tim Graham for comments and reviews and Jamie Cockburn for initial patch.
Diffstat (limited to 'django/db/backends/postgresql/operations.py')
-rw-r--r--django/db/backends/postgresql/operations.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/django/db/backends/postgresql/operations.py b/django/db/backends/postgresql/operations.py
index bff8e87d68..268fa99b51 100644
--- a/django/db/backends/postgresql/operations.py
+++ b/django/db/backends/postgresql/operations.py
@@ -1,6 +1,7 @@
from psycopg2.extras import Inet
from django.conf import settings
+from django.db import NotSupportedError
from django.db.backends.base.operations import BaseDatabaseOperations
@@ -247,3 +248,12 @@ class DatabaseOperations(BaseDatabaseOperations):
rhs_sql, rhs_params = rhs
return "(interval '1 day' * (%s - %s))" % (lhs_sql, rhs_sql), lhs_params + rhs_params
return super().subtract_temporals(internal_type, lhs, rhs)
+
+ def window_frame_range_start_end(self, start=None, end=None):
+ start_, end_ = super().window_frame_range_start_end(start, end)
+ if (start and start < 0) or (end and end > 0):
+ raise NotSupportedError(
+ 'PostgreSQL only supports UNBOUNDED together with PRECEDING '
+ 'and FOLLOWING.'
+ )
+ return start_, end_