On Fri, 2009-03-13 at 13:22 -0700, sieg...@gmail.com wrote:
> Hello!
> 
> If I'm using the transaction middleware in a management command and
> there is a conflict (e.g. transaction A in process a writes something,
> and transaction B in process b overwrites it) does django detect that
> and if yes what does it do?

That's not an error, unless the database is configured to use serialized
transactions (which is a very rare situation) -- and in that latter
case, it won't happen. The transactions ensure that each transactional
set of operations complete atomically. Normally you will be in the "Read
committed" isolation level in PostgreSQL. Which means an update can
change more rows that you thought from a previous select's result, since
in the interim another transaction might have committed its results
(this is generalised version of the case you're talking about).

> 
> i.e. does it throw an exception in save()?
> or throw one in transaction.commit?

Nothing happens. It's not an error.

At some point (hopefully for 1.1, but maybe not, it remains to be seen)
we will add support for what, in SQL, would be a "SELECT FOR UPDATE"
statement, which prevents other transactions from changing those rows.
It's not a trivial change, though, since it needs to be very user-proof,
so getting the details right is tricky (which is why it might not make
it to 1.1).

Regards,
Malcolm



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

Reply via email to