Return-Path: postarch
Received: by postgres.Berkeley.EDU (5.61/1.29)
	id AA03885; Tue, 10 Mar 92 14:45:02 -0800
Message-Id: <9203102245.AA03885@postgres.Berkeley.EDU>
From: postarch (Postgres Mailing Archive)
Subject: Re: 2-phase locks and deadlocks
To: postgres@postgres.berkeley.edu
Sender: pg_adm@postgres.berkeley.edu
Reply-To: mer@postgres.berkeley.edu
In-Reply-To: Your message of "Tue, 10 Mar 92 08:45:36 PST."
             <9203101645.AA27762@postgres.Berkeley.EDU> 
Date: Tue, 10 Mar 92 14:44:53 PST

you write:

> when doing postquel queries within
> a transaction, is there any fixed order
> in which locks are acquired, or could it be
> different depending upon the particular situation
> when the transaction starts?

The locks are acquired on an as-needed basis.  That is if you scan
a relation (e.g. during a retrieve) a read lock is acquired before the
scan begins.  If you are appending tuples into a relation a write lock
is acquired before the insert takes place.  So the order that locks
are acquired depends on the order of operations in the xaction block.
When you are inside such a block, acquired locks will not be released
until you "end" it.  At the end of each and every xaction all locks
for that xaction are released (complying with 2-pl protocol).

> any news about release 4.0?

I will make an announcement later today.


Jeff Meredith
mer@postgres.berkeley.edu
