Received: from sunpine.krs.ru (SunPine.krs.ru [195.161.16.37]) by hub.org (8.9.3/8.9.3) with ESMTP id WAA33153; Sun, 25 Jul 1999 22:50:43 -0400 (EDT) (envelope-from vadim@krs.ru) Received: from krs.ru (dune.krs.ru [195.161.16.38]) by sunpine.krs.ru (8.8.8/8.8.8) with ESMTP id KAA00796; Mon, 26 Jul 1999 10:50:28 +0800 (KRSS) Sender: root@sunpine.krs.ru Message-ID: <379BCCF4.B95C7092@krs.ru> Date: Mon, 26 Jul 1999 10:50:28 +0800 From: Vadim Mikheev Organization: OJSC Rostelecom (Krasnoyarsk) X-Mailer: Mozilla 4.5 [en] (X11; I; FreeBSD 3.0-RELEASE i386) X-Accept-Language: ru, en MIME-Version: 1.0 To: Philip Warner CC: pgsql-hackers@postgreSQL.org, pgsql-sql@postgreSQL.org, Oleg Bartunov Subject: Re: [HACKERS] Re: [SQL] inserts/updates problem understressing ! References: <3.0.5.32.19990725101824.00b92c50@mail.rhyme.com.au> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Philip Warner wrote: > > The usual way around this sort of problem is to update the counter as the > first thing you do in any transaction. This locks the row and prevents any > possible deadlock: But if there was no record then nothing will be locked... Without ability to read dirty data LOCK is the only way. ... > diagnostics' is not yet applied (I may not have mailed it yet...), and I am > not sure if plpgsql starts a new TX for each statment - if so, you need to ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ It doesn't. > start a TX in the procedure, or prior to valling it. Vadim