Opened 12 years ago

Closed 11 years ago

#3462 closed (wontfix)

model objects can fail during save

Reported by: Jack Moffitt <metajack@…> Owned by: nobody
Component: Generic views Version: master
Severity: Keywords:
Cc: Triage Stage: Design decision needed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: 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 12 years ago by Michael Radziej <mir@…>

Component: Database wrapperGeneric views
Owner: changed from Adrian Holovaty to Jacob
Triage Stage: UnreviewedDesign decision needed

Hmm ... I don't consider it a bug that save() throws an exception, you're supposed to deal with this in your code.

But the documentation should explain it, and generic views should handle it. Perhaps this can be done by re-validating if save() throws a database exception.

We first need to find out what's the best way to take, so I put it into stage "Needs Decision".

comment:2 Changed 11 years ago by Jacob

Resolution: wontfix
Status: newclosed

There's no way we can prevent save() from raising an integrity error, so this is wontfix.

Note: See TracTickets for help on using tickets.
Back to Top