Opened 20 years ago
Closed 20 years ago
#404 closed defect (fixed)
MySQL order_by=['?'] throws ProgrammingError
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 , 20 years ago
comment:2 by , 20 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?