Confused about "Forced update did not affect any rows."
|Reported by:||jeroen.pulles@…||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||1.6|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
I have a DatabaseError("Forced update did not affect any rows.") (from model.save_base).
I cannot reproduce the error; Manually running save(force_update) on not-really-changed objects of the same type in a Django shell doesn't raise this exception.
What does this exception apply to?
I am under the impression that the model.save() force_insert/force_update arguments are there to get control over database operations. And as such I was expecting that force_update would work like a SQL UPDATE: Trying to overwrite a field with the same value is just fine.
I'm submitting this as a ticket as I don't understand why it would be bad that an update didn't affect any rows. I don't care if there is any difference between the stored data and the model when I call .save() on a model. That would be application logic, I think.
And as an aside: The MySQL database I'm using reports a "0 rows affected" on a SQL UPDATE statement with identical values. It doesn't return a warning or anything.