Re: how to force an insert before Raise Exception?

From: Taras Kopets <tkopets(at)gmail(dot)com>
To: giova <giovainstall2(at)yahoo(dot)fr>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: how to force an insert before Raise Exception?
Date: 2011-04-19 15:26:30
Message-ID: BANLkTim=ke+gnwedsKO6oBcjymLTxQLeVA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Apr 19, 2011 at 4:39 PM, giova <giovainstall2(at)yahoo(dot)fr> wrote:
> My problem is that i want to do an INSERT into a log table before to raise
> the exception. But RAISE EXCEPTION cancels my Insert.

That's the point of transaction, if it failed the data and any other
changes are rolled back.
You can use dblink (http://www.postgresql.org/docs/current/static/dblink.html)
which will issue a separate connection to database to simulate
autonomous transaction.

Regards,
Taras Kopets

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Phoenix Kiula 2011-04-19 15:56:31 Questions about Partitioning
Previous Message Adrian Klaver 2011-04-19 14:47:22 Re: how to force an insert before Raise Exception?