model objects can fail during save
|Reported by:||Owned by:||nobody|
|Cc:||Triage Stage:||Design decision needed|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Currently django uses an existence test (at least on postgresql_psycopg2 backend, but I assume it does the same thing everywhere) before and INSERT or UPDATE to decide which to do. This can fail if another connection does an INSERT or a DELETE while the existence test is running, even in a transaction block (unless the transaction isolation level is serializable) as each statement can potentially see a different view of the database depending on which transactions have already completed before that statement executes.
I'm not sure how to fix this (serializable transactions are probably not the right answer), and it is probably an edge case for most applications, but I'm entered a bug for it so that people know this issue exists.
Change History (2)
comment:1 Changed 10 years ago by
|Component:||Database wrapper → Generic views|
|Owner:||changed from Adrian Holovaty to Jacob|
|Patch needs improvement:||unset|
|Triage Stage:||Unreviewed → Design decision needed|