On Mar 19, 2006, at 16:22, Jeremy H. wrote:
This isn’t a race condition, this is simply a data integrity issue.
I thought of it as a race condition between add_post and delete_user
because since add_post is not atomic it can find a user in one line,
assume it exists in the next one, and have delete_user break that in
between in a separate session.
If I could get a lock somehow, I could guarantee that when add_post
finishes the user is still there, which is all I am worried about, if
when the lock is released delete_user gets the lock and deletes the
user and his posts that’s fine (the rendered post listing in the
response of add_post might be out of sync, but that’s inherent to web
Just for the record this user/post scenario is indeed an imaginary
example that depicts the pattern.
can’t assume the database checks foreign key integrity, but we can
program it to do so and that is a practice I recommend because it is
efficient and reliable.
I am not familiar with database programming. What do you mean?
Programming it how? My application uses SQLite if that’s relevant.