Opened 18 years ago

Closed 17 years ago

#3462 closed (wontfix)

model objects can fail during save

Reported by: Jack Moffitt <metajack@…> Owned by: nobody
Component: Generic views Version: dev
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

Description

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 by Michael Radziej <mir@…>, 18 years ago

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 by Jacob, 17 years ago

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