Hi all,

[9967] introduced a failure into the test suite, highlighting either
an error in the documentation, or a potentially nasty problem that
requires fixing.

According to the docs[1] :

"The update() method is applied instantly and doesn't return anything"

Except... it does.

Further complicating matters: the value that is returned varies
slightly depending on the database. Postgres and SQLite return the
number of rows that were potentially affected - i.e., the number of
rows that match the selection criteria. MySQL, however, returns the
number of rows that are actually modified. This means that if no
columns are changed as a result of an update, a successful MySQL
update call will return a value different that returned by SQLite and
Postgres.

This is the cause of the failure introduced by [9967] - this changeset
introduces a test [2] to model_inheritance_regress that makes 2
successive calls to update a model attribute to the same value - under
MySQL, the second call isn't a modification, so it returns 0, not 1.

So - which one is correct? Documentation or implementation? And which
one can we change without violating backwards compatibility?

Personally, I'm inclined to go with the documentation being correct -
we already have a backend inconsistency, and I can't imagine the
situation getting any better if non-SQL backends are added to the mix.
However, I am also sensitive to the fact that someone might have a use
case for a return value coming from update().

Opinions?

[1] 
http://docs.djangoproject.com/en/dev/topics/db/queries/#updating-multiple-objects-at-once
[2] http://code.djangoproject.com/changeset/9967#file2

Yours,
Russ Magee %-)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to