﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
2150	slicing to the end of a QuerySet	Gary Wilson <gary.wilson@…>	nobody	"Currently, when trying to slice to the end of a QuerySet, an AssertionError is raised:

{{{
#!python
>>>Foo.objects.all()[3:]
Traceback (most recent call last):
  File ""<console>"", line 1, in ?
  File ""/usr/lib/python2.4/site-packages/django/db/models/query.py"", line 88, in __repr__
    return repr(self._get_data())
  File ""/usr/lib/python2.4/site-packages/django/db/models/query.py"", line 412, in _get_data
    self._result_cache = list(self.iterator())
  File ""/usr/lib/python2.4/site-packages/django/db/models/query.py"", line 162, in iterator
    select, sql, params = self._get_sql_clause()
  File ""/usr/lib/python2.4/site-packages/django/db/models/query.py"", line 490, in _get_sql_clause
    assert self._offset is None, ""'offset' is not allowed without 'limit'""
AssertionError: 'offset' is not allowed without 'limit'
}}}

However, returning rows from an offset to the end of a result set does seem possible...

'''in MySQL (>=3.23)'''

''""To retrieve all rows from a certain offset up to the end of the result set, you can use some large number for the second parameter. This statement retrieves all rows from the 96th row to the last:""''

http://dev.mysql.com/doc/refman/4.1/en/select.html

{{{
#!sql
SELECT * FROM tbl LIMIT 95,18446744073709551615;
}}}

'''and in PostgreSQL (>=7.3)'''

''""LIMIT ALL is the same as omitting the LIMIT clause.""''

http://www.postgresql.org/docs/7.3/static/queries-limit.html

{{{
#!sql
SELECT select_list
    FROM table_expression
    [LIMIT { number | ALL }] [OFFSET number]
}}}"	enhancement	closed	Database layer (models, ORM)	dev	normal	fixed	qs-rf-fixed	gary.wilson@… ferringb@…	Accepted	0	0	0	0	0	0
