From e0a3cfaca0088d82e625627a57e56b9f1a77b011 Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Tue, 17 Apr 2018 18:50:43 +0200 Subject: [PATCH] Simplified Oracle's DatabaseOperations.cache_key_culling_sql() with LIMIT/OFFSET. --- django/db/backends/oracle/operations.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/django/db/backends/oracle/operations.py b/django/db/backends/oracle/operations.py index d11072bd2c..9e410ad810 100644 --- a/django/db/backends/oracle/operations.py +++ b/django/db/backends/oracle/operations.py @@ -56,11 +56,7 @@ END; } def cache_key_culling_sql(self): - return """ - SELECT cache_key - FROM (SELECT cache_key, rank() OVER (ORDER BY cache_key) AS rank FROM %s) - WHERE rank = %%s + 1 - """ + return 'SELECT cache_key FROM %s ORDER BY cache_key OFFSET %%s ROWS FETCH FIRST 1 ROWS ONLY' def date_extract_sql(self, lookup_type, field_name): if lookup_type == 'week_day':