Received: from sapphire.albourne.com (root@sapphire.albourne.com [195.212.241.227]) by hub.org (8.9.3/8.9.3) with ESMTP id CAA71243 for ; Mon, 26 Jul 1999 02:57:24 -0400 (EDT) (envelope-from a.joubert@albourne.com) Received: from isadora.cy.albourne.com (akamas.albourne.com [195.212.241.254]) by sapphire.albourne.com (8.9.3/8.9.3/Albourne/CYS/1.6X) with ESMTP id JAA11654; Mon, 26 Jul 1999 09:58:37 +0300 (EET DST) Received: from albourne.com (localhost [127.0.0.1]) by isadora.cy.albourne.com (8.9.3/8.9.3/Albourne/CYC/1.4) with ESMTP id JAA21592; Mon, 26 Jul 1999 09:57:18 +0300 (EET DST) Sender: a.joubert@albourne.com Message-ID: <379C06CE.70797269@albourne.com> Date: Mon, 26 Jul 1999 09:57:18 +0300 From: Adriaan Joubert Organization: APL Financial Services (Overseas) Ltd X-Mailer: Mozilla 4.6 [en] (X11; I; OSF1 V4.0 alpha) X-Accept-Language: en MIME-Version: 1.0 CC: Oleg Bartunov , pgsql-hackers@postgreSQL.org Subject: Re: [HACKERS] Re: [SQL] inserts/updates problem under stressing ! References: <379BFF7E.BD57269E@krs.ru> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit > > > > my $sth = $dbh->do("LOCK TABLE hits IN SHARE ROW EXCLUSIVE MODE"); > > my $sth = $dbh->do("SELECT acc_hits($1)") || die $dbh->errstr; > > > > am I right ? > > You should run LOCK and SELECT inside BEGIN/END (i.e. in > the same transaction), do you? Yes, in DBI that translates to switching AutoCommit off, and doing an explicit commit, (roughly) $dbh->{AutoCommit} = 0; eval { $dbh->do (...) ... }; if ($@) { // There was an error $dbh->rollback(); } else { $dbh->commit(); } I think you need to set RaiseError=>1 as well when connecting to the database, to get die's inside the eval. Adriaan