﻿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
17332	Doing a save after primary key has changed should raise an error	Anssi Kääriäinen	nobody	"Currently, if you change primary key and do a save(), you will get a duplicate in the database. In effect, the current behavior of save is: ""save the object to DB, except when PK has changed, then do a clone"". This API is not good for natural primary keys. Natural primary keys aren't that common currently, but if multicolumn primary keys are introduced into Django, they will be more common.

The idea is to deprecate the current clone behavior of save raise an error instead. This would need to go through the normal deprecation cycle. You can get the current behavior back by using .save(clone=True). For `AutoFields`, setting the pk to None will work.

For implementation the problems are: How to trac primary key changes? Some fields are mutable inplace, which makes the problem harder. Model `__init__` should not be made much slower by this.

Some related tickets: #2259, #4102. There is also a [https://groups.google.com/group/django-developers/browse_thread/thread/b028e3c7a366330e/58c37e1988d5d8ef#58c37e1988d5d8ef Django-developers thread] about this."	Uncategorized	closed	Database layer (models, ORM)	1.3	Normal	wontfix		Anssi Kääriäinen	Design decision needed	1	1	1	0	0	0
