﻿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
9864	Error message regarding mysql version is never used in the code added by r9650	ElliottM	nobody	"In django.db.backends.mysql.validation, there is the following code to handle validation of varchar fields:


{{{
19 	            if db_version < (5, 0, 3):
20 	                msg = '""%(name)s"": %(cls)s cannot have a ""max_length"" greater than 255 when you are using a version of MySQL prior to 5.0.3 (you are using %(version)s).'
21 	            if f.unique == True:
22 	                msg = '""%(name)s"": %(cls)s cannot have a ""max_length"" greater than 255 when using ""unique=True"".'
23 	            else:
24 	                msg = None
}}}

If you look carefully, the mysql version ends up being irrelevant. The cause is the ""else"" on line 23. The ""if"" it matches to only tests for unique=True, so if unique is false then msg will be None, even if the user has an incompatible mysql version.

To solve it, I removed the else, put ""msg=None"" above the two if ststements, then switched the two if statements. The reason for the switch is that if the user both has a unique field and has an incompatible version, we want to display the incompatible version error message.
"		closed	Database layer (models, ORM)	1.0		fixed			Unreviewed	1	0	0	0	0	0
