On Tue, Mar 26, 2013 at 12:40 PM, Anssi Kääriäinen <anssi.kaariai...@thl.fi>wrote:
> Hmmh, this means Oracle, MSSQL, DB2 and Informix are doing more or less > the same thing for limit/offset support? If so, then having a more generic > approach to this problem than having a custom compiler per backend might be > worth it... > I haven't looked at the DB2 or Informix code, but Oracle and MSSQL have a custom SQLCompiler primarily to handle constructing SQL to deal with limit/offset. A generic approach would be nice to have, but I can't imagine a generic way that would let me generate the "SELECT ... FROM (SELECT ROW_NUMBER() OVER (...)) WHERE ..." monstrosity with lots of column aliasing that I currently construct. I'm definitely interested in brainstorming what a generic approach might look like. > BTW there is already something like LIMIT and OFFSET in SQL 2008 standard. > The syntax is different than LIMIT/OFFSET, and supported only by some > vendors... See > https://en.wikipedia.org/wiki/Select_%28SQL%29#FETCH_FIRST_clause > The SQL 2008 standard added FETCH FIRST, which covers the LIMIT part of the problem, but I didn't see anything in the standard to deal with OFFSET, which is usually the more painful part of the problem. Window functions were added in the 2003 standard, but they can have some issues with ordering and I don't think the standard requires a way of being able to filter by some sort of result row number. Regards, Michael Manfre -- You received this message because you are subscribed to the Google Groups "Django developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at http://groups.google.com/group/django-developers?hl=en. For more options, visit https://groups.google.com/groups/opt_out.