﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
7580	Support ORDER BY BINARY in MySQL	Paul Kenjora <pkenjora@…>	anonymous	"The Problem:

MySQL supports both ORDER BY and ORDER BY BINARY.

ORDER BY does NOT match the string sort used by Python but ORDER BY BINARY DOES.  Lots of issues arise when returned list from DB needs to be in proper order.  

The problem is described well at: http://blog.awarelabs.com/?p=18 (article by the reporter of this ticket)

The Proposed Fix:

Add a `__binary` tag to the end of any `order_by('column')` caluse, like so `order_by('column__binary')`.
Strip the `__binary` tag before any processing and ensure 'BINARY ' is inserted into generated SQL.
The above solution ensures existing behavior is not altered.  It does carry the side effect of making `__binary` a reserved word which come to think of it is reserved in SQL so no issue there.
"		assigned	Database layer (models, ORM)	dev			mysql, binary, order by		Design decision needed	1	0	0	0		
