Opened 19 years ago
Closed 19 years ago
#404 closed defect (fixed)
MySQL order_by=['?'] throws ProgrammingError
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Metasystem | Version: | |
Severity: | normal | Keywords: | mysql order order_by random |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
When attempting to get a list in random order with MySQL as the backend, this error is thrown:
book_list = books.get_list(slug__ne=kwargs['book'], order_by=['?']) ... ProgrammingError: (1064, "You have an error in your SQL syntax near '()' at line 1")
I would guess it's a db abstraction issue. MySQL uses ORDER BY RAND() for random ordering, I believe.
Revision 545, MySQL 3.23, Mac OS X.3.9
Change History (4)
comment:1 by , 19 years ago
comment:2 by , 19 years ago
Component: | Database wrapper → Metasystem |
---|---|
Status: | new → assigned |
Note:
See TracTickets
for help on using tickets.
In django/core/meta/init.py:
needs to be
for MySQL, but I'm guessing that would then break postgres and/or sqlite. Is there an easy way to abstract it?