Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 4E6C49FBD8E for ; Thu, 1 Mar 2007 10:47:09 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-new, port 10024) with ESMTP id 73818-02 for ; Thu, 1 Mar 2007 10:47:04 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from mail.unl.edu.ar (mail.unl.edu.ar [168.96.132.10]) by postgresql.org (Postfix) with SMTP id 3B9AD9FBD92 for ; Thu, 1 Mar 2007 10:47:03 -0400 (AST) Received: (qmail 17444 invoked by uid 1010); 1 Mar 2007 14:46:48 -0000 Received: from 168.96.132.199 by scanner-pc-m- (envelope-from , uid 1002) with qmail-scanner-0.2 (sophie: 3.04/2.38/4.10. spamassassin: 3.1.0-rc2. perlscan: 0.2. Clear:RC:1(168.96.132.199):. Processed in 0.104089 secs); 01 Mar 2007 14:46:48 -0000 Received: from xennon.unl.edu.ar (HELO ?192.168.1.68?) (168.96.132.199) by mail.unl.edu.ar with SMTP; 1 Mar 2007 14:46:48 -0000 Message-ID: <45E6E75F.4020408@bugs.unl.edu.ar> Date: Thu, 01 Mar 2007 11:46:55 -0300 From: Martin Marques User-Agent: Icedove 1.5.0.9 (X11/20061220) MIME-Version: 1.0 To: mikie CC: pgsql-php@postgresql.org Subject: Re: transactions from PHP - double COMMIT required? References: <20070301131523.fgfm83nb9y2kgo4c@imp3.uta.fi> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.011 tagged_above=0 required=5 tests=AWL, BAYES_50 X-Spam-Level: X-Archive-Number: 200703/11 X-Sequence-Number: 3723 mikie wrote: >> > But getting back to my problem - perhaps there is something I >> > misunderstood: is it the client application responsibility to check if >> > the transaction failed or succeeded and issue COMMIT or ROLLBACK >> > accordingly (how do I close the transaction block in that case)? >> > Or is it the database server that is suppose to check if transaction >> > succeded and perform the query, or ROLLBACK if anything went wrong? >> >> PG will rollback all transactions that have an error in some part, as it >> can't commit the transaction as a whole. > > OK, so my way of programming seems correct. > Then why do I have to send another COMMIT after failed transaction to > continue with next queries in the same php script ? I may not have gotten your question right, but with one commit (or end) is enough. Transaction gets closed (commited or rolled back), and you can start a new transaction with BEGIN. -- 21:50:04 up 2 days, 9:07, 0 users, load average: 0.92, 0.37, 0.18 --------------------------------------------------------- Lic. Martín Marqués | SELECT 'mmarques' || Centro de Telemática | '@' || 'unl.edu.ar'; Universidad Nacional | DBA, Programador, del Litoral | Administrador ---------------------------------------------------------