Обсуждение: Re: How to insert in a table the error returns by query

Поиск
Список
Период
Сортировка

Re: How to insert in a table the error returns by query

От
David G Johnston
Дата:
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.html
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.