﻿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
11665	django.test.TestCase should flush constraints	Glenn Maynard	Tim Graham <timograham@…>	"In Postgresql, constraints are set DEFERRABLE INITIALLY DEFERRED.  This causes it to only check those constraints when the transaction is committed.  (This may affect the Oracle backend, too, based on a quick search.)

This causes a problem with TestCase: as they're never committed, many constraint violations can never be triggered.

It's an easy fix: cause SET CONSTRAINTS ALL IMMEDIATE to be executed in TestCase before rolling back the transaction, so any deferred constraints are flushed, and treat an exception from that as a test failure.

I'll work on a patch in a week or so when I have some time.  I'm not sure how to test this, since it means testing the testing system itself.
"	Bug	closed	Testing framework	dev	Normal	fixed		glenn@… peruano@… aball@… Forest Bond nperriault@… jim.dalton@… graham@… botondus@… vlastimil.zima@… jon.dufresne@…	Accepted	1	0	0	0	0	0
