X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7E0E7D1B199 for ; Wed, 14 Jul 2004 20:38:21 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 81835-07 for ; Wed, 14 Jul 2004 23:38:15 +0000 (GMT) Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by svr1.postgresql.org (Postfix) with SMTP id 5E5AAD1B1A5 for ; Wed, 14 Jul 2004 20:38:11 -0300 (ADT) Received: (qmail 10068 invoked from network); 14 Jul 2004 23:38:10 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.36?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 14 Jul 2004 23:38:10 -0000 Subject: Re: No exception with concurrent updates From: Dave Cramer Reply-To: pg@fastcrypt.com To: Vladimir Stankovic Cc: "pgsql-jdbc@postgresql.org" In-Reply-To: References: Content-Type: text/plain Organization: Cramer Consulting Message-Id: <1089848319.1548.60.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Wed, 14 Jul 2004 19:38:39 -0400 Content-Transfer-Encoding: 7bit X-AntiVirus: scanned for viruses by AMaViS 0.2.1 (http://amavis.org/) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200407/164 X-Sequence-Number: 10548 Yes, you are correct, it should be handled properly in this case, you should look at the logs in the postgresl log, to see what is really going on, it is possible they truly aren't concurrent. Set logpid on, and log statement Dave On Wed, 2004-07-14 at 17:36, Vladimir Stankovic wrote: > Dave, > > On Jul 14 2004, Dave Cramer wrote: > > > Vladimir, > > > > This simply won't work, you will need to either synchronize transaction, > > or use some other locking mechanism. As I said, postgres supports > > concurrent transactions, they will both succeed simultaneously. > > > I thought that this is taken care of when you set TRANSACTION_SERIALIZABLE on > the Connection object. > > > Your options are select the row for update, which will lock it from > > other transactions updating it. > > > > synchronize transaction so that only one gets in there at a time. > > > > use pessimistic locking which involves a timestamp and you have to check > > to make sure that the row has not changed before you update it, although > > without synchronization this won't work either. > > > > Dave > > > > > This programme was a part of the comparison between PostgreSQL and InterBase > (known now under name Firebird for open source developement) regarding their > concurrent updates handling, which as I know doesn't use 2 Phase Commit either. > The term for MVCC in IB is multi-generational database architecture. By the way > there exist the NO WAIT parameter in IB, which can be specified when starting a > transaction and does not require a transaction to wait until the end of > concurrent transaction. Using this mode the first version of my programme > (without threads) did not halt - I received the exception and the second > transaction's update did not commit. > > Thanks for the prompt responses, > > Vladimir > > ________________________________________________________________________ > > Vladimir Stankovic Tel: +44 20 7040 0273 > Research Student Fax: +44 20 7040 8585 > Centre for Software Reliability Email: V.Stankovic@city.ac.uk > City University > Northampton Square, London EC1V 0HB > ________________________________________________________________________ > > > > > !DSPAM:40f5a78e197681998034425! > > -- Dave Cramer 519 939 0336 ICQ # 14675561