﻿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
26351	Recommend enabling MySQL's STRICT_TRANS_TABLES to prevent silent truncation	Zhebrak Alexander	nobody	"{{{#!python
class Post(models.Model):
    title = models.CharField(max_length=10)


search_title = 'A' * 11

Post.objects.get_or_create(title=search_title)
Post.objects.get_or_create(title=search_title)
}}}

This code creates two objects because lookup is trying to find non-truncated title and fails to get one so it creates a new object with a truncated title. The second call does exactly the same creating another object.

I don't know if it supposed to work this way or not but this behavior seems unclear to me."	Cleanup/optimization	closed	Documentation	1.9	Normal	fixed	get_or_create, max_length	me@…	Ready for checkin	1	0	0	0	0	0
