X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C31B09DCDAE for ; Sat, 18 Mar 2006 02:12:53 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 27105-05 for ; Sat, 18 Mar 2006 02:12:53 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.205]) by postgresql.org (Postfix) with ESMTP id 95B899DCD94 for ; Sat, 18 Mar 2006 02:12:51 -0400 (AST) Received: by wproxy.gmail.com with SMTP id 71so6352wra for ; Fri, 17 Mar 2006 22:12:52 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:from:to:subject:date:user-agent:mime-version:content-type:content-transfer-encoding:content-disposition:message-id; b=uYvayQZFXskoY1frL8etxI72bIowH6lpXyb3a22HWKr0l1SyW5OPWR5pWzKaDMza66f1eqlbAk0owblUVAncJ7NVdWj7slDwoDpGD4XjkP/3JS+eQ7yy9n5OfY25NbjcMYnsqqiQXIMUbmjBMJ7kAgVStX8m7rX086R6qALsJd8= Received: by 10.54.83.8 with SMTP id g8mr2123444wrb; Fri, 17 Mar 2006 22:12:51 -0800 (PST) Received: from ?10.0.2.3? ( [200.62.104.37]) by mx.gmail.com with ESMTP id 39sm2252488wrl.2006.03.17.22.12.51; Fri, 17 Mar 2006 22:12:51 -0800 (PST) From: Kevin Brown To: pgsql-general@postgresql.org Subject: Transactions Date: Sat, 18 Mar 2006 00:20:00 -0600 User-Agent: KMail/1.8.3 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200603180020.01418.blargity@gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.12 required=5 tests=[AWL=0.120] X-Spam-Score: 0.12 X-Spam-Level: X-Archive-Number: 200603/806 X-Sequence-Number: 92671 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?