On Aug 20, 1:01 pm, Justin Bronn <[EMAIL PROTECTED]> wrote:
> > Item.objects.dates('created', 'day')[0]
> > DatabaseError: ORA-00923: FROM keyword not found where expected
>
> That's the exact error that's giving me problems -- I think it's one
> of the same issue as I'm having.  It's because of the `col.rsplit('.',
> 1)[1]` logic in Oracle's `as_sql` when doing offsets.  In other words
> when the column is wrapped in a function (like the datetime SQL is)
> then there will be a parenthesis after the quote still in the column
> name.

That's true, and it's obviously a bug, but sadly there are a couple
other errors involved in this particular failure.  First is that one
column is a TRUNC(date) function without a column alias, so there's no
way to SELECT that in the outer query.  Second is that the query uses
DISTINCT, but we blindly injected our ROW_NUMBER() function as the
first column, which creates invalid SQL since DISTINCT must appear
before the column list.  Then there's our mis-parsing of the column
name with parentheses.

I now think reintroducing the extra_select approach might work better,
and perhaps could fix the GeoDjango issues as well.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to