Transactions

From: Kevin Brown <blargity(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Transactions
Date: 2006-03-18 06:20:00
Message-ID: 200603180020.01418.blargity@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Kevin Brown 2006-03-18 06:45:44 Re: Transactions
Previous Message Tom Lane 2006-03-18 06:19:15 Re: Transactions