Fixed #23061: Avoided setting a limit on a query for get with select_for_update on Oracle

Thanks Michael Miller for reporting the issue.
This commit is contained in:
Shai Berger 2014-08-01 01:36:06 +03:00
parent 6d256ae248
commit 746f2a4bed
4 changed files with 14 additions and 1 deletions

View file

@ -357,7 +357,9 @@ class QuerySet(object):
clone = self.filter(*args, **kwargs)
if self.query.can_filter():
clone = clone.order_by()
clone = clone[:MAX_GET_RESULTS + 1]
if (not clone.query.select_for_update or
connections[self.db].features.supports_select_for_update_with_limit):
clone = clone[:MAX_GET_RESULTS + 1]
num = len(clone)
if num == 1:
return clone._result_cache[0]