agora inbox for pgsql-sql@postgresql.org
help / color / mirror / Atom feedFrom: David G Johnston <david.g.johnston@gmail.com>
To: pgsql-sql@postgresql.org
Subject: Re: How to insert in a table the error returns by query
Date: Wed, 28 Jan 2015 09:55:00 -0700 (MST)
Message-ID: <1422464100577-5835803.post@n5.nabble.com> (raw)
In-Reply-To: <1422445747001-5835771.post@n5.nabble.com>
References: <1422445747001-5835771.post@n5.nabble.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>
ciamblex wrote
> I need to save in a table the error code (SQLSTATE) and the error message
> (SQLERRM) returned by an insert or an update. My procedure must execute an
> insert, and if an error occurs, it must be saved into an apposite table.
>
> But the problem is that if I use the EXCEPTION BLOCK, when an error occurs
> the transaction is aborted and any command after cannot be execute.
>
> How can I save the error returned by a query in a table, using PLPGSQL???
>
> Thanks
The typical solution seems to be to use dblink to open an independent
session that is not affected by rollback when the main session cronks. I'm
not sure if FDWs work for this purpose...
David J.
--
View this message in context: http://postgresql.nabble.com/How-to-insert-in-a-table-the-error-returns-by-query-tp5835771p5835803.h...
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
view thread (6+ messages) latest in thread
Message-ID: <1422464100577-5835803.post@n5.nabble.com>
Permalink: ../1422464100577-5835803.post@n5.nabble.com/
Also on: postgresql.org/message-id/1422464100577-5835803.post@n5.nabble.com
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: david.g.johnston@gmail.com
Subject: Re: How to insert in a table the error returns by query
In-Reply-To: <1422464100577-5835803.post@n5.nabble.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox