Re: in failed sql transaction

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Ralf Wiebicke <ralf(dot)wiebicke(at)exedio(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: in failed sql transaction
Date: 2006-09-24 23:40:09
Message-ID: 20060924234009.GA43233@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Markus Grabner 2006-09-25 00:56:47 query rewrite rules for updateable views?
Previous Message Bob Pawley 2006-09-24 23:31:20 Re: serial column