Re: in failed sql transaction - Mailing list pgsql-general

From Michael Fuhr
Subject Re: in failed sql transaction
Date
Msg-id 20060924234009.GA43233@winnie.fuhr.org
Whole thread Raw
In response to in failed sql transaction  (Ralf Wiebicke <ralf.wiebicke@exedio.com>)
Responses Re: in failed sql transaction
List pgsql-general
On Sun, Sep 24, 2006 at 12:03:59PM +0200, Ralf Wiebicke wrote:
> I just realized the following behaviour in postgresql: when I violate any
> constraint (unique constraint in my case) then the transaction is not usable
> anymore. Any other sql command returns a "in failed sql transaction" error.

Transactions are all-or-nothing: all statements must succeed or the
transaction fails (but see below regarding savepoints).

> All other databases I used up to now just ignore the statement violating the
> constraint, but leave the transaction intact.

Which databases behave that way?  Does COMMIT succeed even if some
statements failed?

> Is this intended behaviour or rather a bug? Or is there any way to "switch on"
> the behaviour I'd like to see?

This is intended behavior.  You can use savepoints to roll back
part of a transaction so the transaction can continue after an
error.

--
Michael Fuhr

pgsql-general by date:

Previous
From: Bob Pawley
Date:
Subject: Re: serial column
Next
From: Markus Grabner
Date:
Subject: query rewrite rules for updateable views?