Received: from p1.selectacast.net (IDENT:root@p1.selectacast.net [206.41.1.251]) by hub.org (8.10.1/8.10.1) with ESMTP id e6D2ZRW39631 for ; Wed, 12 Jul 2000 22:35:27 -0400 (EDT) Received: from selectacast.net (IDENT:jks@d1 [209.219.91.66]) by p1.selectacast.net (8.9.3/8.9.3) with ESMTP id WAA15435 for ; Wed, 12 Jul 2000 22:35:25 -0400 Message-ID: <396D2AEA.5D19984A@selectacast.net> Date: Wed, 12 Jul 2000 22:35:22 -0400 From: Joseph Shraibman Organization: Xtenit X-Mailer: Mozilla 4.72 [en] (X11; U; Linux 2.2.15 i686) X-Accept-Language: en MIME-Version: 1.0 To: "pgsql-general@hub.org" Subject: select for update not locking properly. Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200007/548 I have a program that does this: BEGIN; SELECT mystring FROM mytable WHERE x = 3 AND y = 4 FOR UPDATE; UPDATE mytable SET mystring = '' WHERE x = 3 AND y = 4; END; But the locking isn't working properly. I do something that should cause 3 different threads to try and do that append, and the first one goes through properly, but the second two append to the result of the first on only, meaning that the third one didn't see the result of the second's append. I tried to make a simple example that reproduced this, but failed. I'm guessing that the value of that the select is generated before the row is locked, and thus each of my last two threads saw the table after the first append, *then* one of them blocked because the other had locked the table. It's the only thing I can figure.