Re: [GENERAL] How to get an exception detail in a function called inexception handler - Mailing list pgsql-general

From Shakti Singh
Subject Re: [GENERAL] How to get an exception detail in a function called inexception handler
Date
Msg-id CAH19PkkhipBTYQDzANXXi3qxj5ucov--5d0uWuAAumTPsHAmCg@mail.gmail.com
Whole thread Raw
In response to Re: [GENERAL] How to get an exception detail in a function called in exception handler  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Thanks for the reply Tom!

The log_error_function is being called by thousands of functions and that is why I thought it would be great if there was a way without making changes to it and subsequently writing code to pass the parameters in all these exception block.

Would have been awesome if error logging function could get the previous exception details somehow.

Thanks,


Shakti Singh


On Tue, Jan 24, 2017 at 11:13 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Shakti Singh <shakti.0123@gmail.com> writes:
> In oracle sqlcode and sqlerrm can be accessed in a function called from an
> exception block.
> How do I do this in PostgreSQL

In PG those are local variables within an exception block.  You'd have to
pass their values to the error-logging function explicitly.

                        regards, tom lane

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: [GENERAL] How to get an exception detail in a function called in exception handler
Next
From: Joshua Chamberlain
Date:
Subject: Re: [GENERAL] Why is materialized view creation a "security-restrictedoperation"?