pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jan Peters <petersjan@gmx.at>
To: pgsql-sql@postgresql.org
Subject: Rollback locks table - why?
Date: Thu, 20 Mar 2008 14:44:33 +0100
Message-ID: <20080320134433.259270@gmx.net> (raw)

Hello list,
I am a bit confused. See the code below:

BEGIN;
SAVEPOINT sp1;
INSERT INTO test(id,runde) VALUES(2, 0);
--if there is a unique key violstion:
ROLLBACK TO sp1;
UPDATE test  SET id = 1000 WHERE runde = 0;
COMMIT;

When I first run this statement, I do not get any error message, but also there's also no INSERT on table test. If I run just:

INSERT INTO test(id,runde) VALUES(2, 0);

on its own, it works. (i.e. I get a new row). If I run the transaction block from above again I get first a unique key violation (that is ok, because that's what I trying to check for) but there is NO rollback to sp1, only the "Unique Key" error message and after that I get the dreaded "current transaction is aborted" error message and the system reports an EXCLUSIVE LOCK on the table (<IDLE>in transaction).

Any ideas what I am doing wrong?

Using PostGreSQL 8.2.7 on Windows XP.

Regards and many thanks in advance
Jan
-- 
Psssst! Schon vom neuen GMX MultiMessenger gehört?
Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger

-- 
GMX startet ShortView.de. Hier findest Du Leute mit Deinen Interessen!
Jetzt dabei sein: http://www.shortview.de/?mc=sv_ext_mf@gmx



view thread (10+ messages)  latest in thread

Message-ID: <20080320134433.259270@gmx.net>
Permalink:  ../20080320134433.259270@gmx.net/
Also on:    postgresql.org/message-id/20080320134433.259270@gmx.net

 · 

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: petersjan@gmx.at
  Subject: Re: Rollback locks table - why?
  In-Reply-To: <20080320134433.259270@gmx.net>

* 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