From: Kevin Brown <blargity@gmail.com>
To: pgsql-general@postgresql.org
Subject: Transactions
Date: Sat, 18 Mar 2006 00:20:00 -0600
Message-ID: <200603180020.01418.blargity@gmail.com> (raw)
I've been creating a databased application with PostgreSQL for a while now and
have loved it, though we just recently stumbled on an interesting bug.
I have a particular dialog which can do all kinds of incredibly complicated
things to the database. Of course I didn't want to have to write the "undo
it to the database" code, nor did I want to force the user into being screwed
with a stray click.
So when the dialog opens, it executes a BEGIN, and then based on whether they
clicked ok or cancel on the dialog, it'd COMMIT or ROLLBACK. This worked
fine for me in testing, but now that I have two people using this app
simulatneously, if they both click on ok at the same time, postgres seemingly
deadlocks. My setup is such that I have n ruby clients talking with DRb to
another ruby process on the server, which then does all the communication to
postgres. Each user has his/her own database connection.
So how can I accomplish this behavior without the deadlock?
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: blargity@gmail.com
Subject: Re: Transactions
In-Reply-To: <200603180020.01418.blargity@gmail.com>
References: <200603180020.01418.blargity@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox