On Wednesday, June 13, 2012 5:48:07 AM UTC-6, rahajiyev wrote: > > DatabaseError at / > > ORA-01446: cannot select ROWID from, or sample, a view with DISTINCT, GROUP > BY, etc. > > > Unfortunately Django doesn't show the precise statement that caused the > error. >
The query it generates is: SELECT * FROM (SELECT ROWNUM AS "_RN", "_SUB".* FROM (SELECT "CREF_TAB"."ROWID", "CREF_TAB"."CREF_NO" FROM "CREF_TAB") "_SUB" WHERE ROWNUM <= 5) WHERE "_RN" > 0 (You can find this using str(queryset.query) in a Django shell.) The error appears to be caused by the outermost SELECT *, since the query runs all right if you remove it. It also works if you add an alias to the rowid column, e.g. "SELECT CREF_TAB.ROWID AS FOOBEAR". You might be able to finagle the Field into adding a column alias, but then you will likely break something else. I think we're back to using extra(). -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/US4jxwn9mc4J. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.