pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Sullivan <ajs@crankycanuck.ca>
To: pgsql-sql@postgresql.org
Subject: Re: Changing the transaction isolation level within the	stored
Date: Thu, 26 Jan 2006 06:39:02 -0500
Message-ID: <20060126113902.GB3995@phlogiston.dyndns.org> (raw)
In-Reply-To: <43D8999E.9090907@logix-tt.com>
References: <1138198348.8828.32.camel@localhost.localdomain>
	<43D79132.9050900@logix-tt.com>
	<1138259463.16164.4.camel@localhost.localdomain>
	<43D8999E.9090907@logix-tt.com>

On Thu, Jan 26, 2006 at 10:42:54AM +0100, Markus Schaber wrote:

> AFAIK, in PostgreSQL normal SQL commands cannot create deadlocks at all,
> the only way to introduce deadlocks is to issue LOCK commands to take
> locks manually. And for this rare case, PostgreSQL contains a deadlock
> detection routine that will abort one of the insulting transactions, and
> the others can proceed.

You can too.  Consider this:

t1                                        t2

BEGIN;                                    BEGIN;
UPDATE table1 SET col1=                   UPDATE table2 SET col1=
     col1+5;                                  (SELECT col3 FROM
DELETE FROM table2 WHERE                          table3);
	col1 = col1+6;                    UPDATE table1 SET col1 =
		                                 col1 +5;
COMMIT;                                   COMMIT;

Suppose these are concurrent.  The problem here is that each
transaction need something in the other transaction either to
complete or rollback before the work can proceed.  So one of them has
to lose.

A

-- 
Andrew Sullivan  | ajs@crankycanuck.ca
This work was visionary and imaginative, and goes to show that visionary
and imaginative work need not end up well. 
		--Dennis Ritchie



view thread (13+ messages)  latest in thread

Message-ID: <20060126113902.GB3995@phlogiston.dyndns.org>
Permalink:  ../20060126113902.GB3995@phlogiston.dyndns.org/
Also on:    postgresql.org/message-id/20060126113902.GB3995@phlogiston.dyndns.org

 · 

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: pgsql-sql@postgresql.org
  Cc: ajs@crankycanuck.ca
  Subject: Re: Changing the transaction isolation level within the	stored
  In-Reply-To: <20060126113902.GB3995@phlogiston.dyndns.org>

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

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