agora inbox for postgres@postgres.berkeley.edu  
help / color / mirror / Atom feed
From: Gerry Stringer <gerry@camscan.co.uk>
To: postgres@postgres.berkeley.edu
Subject: Re deadlock ( bug in begin/end? replace?)
Date: Tue, 27 Apr 93 05:15:47 -0700
Message-ID: <9304271215.AA13941@postgres.Berkeley.EDU> (raw)



I've been watching the mail over the last couple of days but still
haven't seen a definitive answer to avoiding deadlock. If:

>a replace query of the form:  
> 
>       replace foo (attribute1 =foo.attribute1 + 1) 
> 
>will first do a scan over foo (acquiring a readlock) then attempt to 
>write a new instance/row/tuple (acquiring a write lock).  any time you 
>"upgrade" a read lock to a write lock you're vulnerable to deadlock.

then how do I code a transaction that is guaranteed not to deadlock?
Would a dummy append do it or should I be considering my own locking
outside Postgres?

	thanks,
		gerry


+--------------------------------+---------------------------------+
|Gerry Stringer                  |Phone: +44 954 780926            |
|Cambridge Scanning Company Ltd  |Fax:   +44 954 789829            |
|Saxon Way                       |UUCP : gerry@camscan.co.uk       |
|Bar Hill                        |       gerry@camscan.uucp        |
|Cambridge CB3 8SL               |       			   |
|United Kingdom                  |                                 |
+--------------------------------+---------------------------------+





reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: postgres@postgres.berkeley.edu
  Cc: gerry@camscan.co.uk
  Subject: Re: Re deadlock ( bug in begin/end? replace?)
  In-Reply-To: <9304271215.AA13941@postgres.Berkeley.EDU>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox