﻿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
17341	Model.save() commits transactions after every parent class save	Anssi Kääriäinen	Anssi Kääriäinen <akaariai@…>	"The bug is that when running outside transaction management, Django does a save() after every update/insert. In multitable inheritance, it is possible (although rare) that this will result in half-saved objects. For example, using postgresql, and model inheritance I get these queries:
{{{
BEGIN
SELECT (1) AS ""a"" FROM ""parent"" WHERE ""parent"".""id"" = 1  LIMIT 1
UPDATE ""parent"" SET ""f1"" = 1 WHERE ""parent"".""id"" = 1 
COMMIT -- Why commit here?
BEGIN
INSERT INTO ""child"" (""parent_ptr_id"", ""pk2"") VALUES (1, NULL)
ERROR:  null value in column ""pk2"" violates not-null constraint
}}}
Now I have committed a half-update. The attached patch gets rid of the COMMIT/BEGIN in the middle.

I found this while hacking on #17332. It has more cleanups for .save (for example proxy handling), but I thought this deserves its own ticket."	Bug	closed	Database layer (models, ORM)	1.3	Normal	fixed		anssi.kaariainen@… sebastian.goll@… charette.s@…	Accepted	1	0	0	1	0	0
