pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Function for Exception Logging
4+ messages / 3 participants
[nested] [flat]

* Function for Exception Logging
@ 2018-10-29 17:02 Patrick FICHE <Patrick.Fiche@aqsacom.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Patrick FICHE @ 2018-10-29 17:02 UTC (permalink / raw)
  To: pgsql-general

Hi community,

I would like to implement a function that would log managed Exceptions into a dedicated table.
For example, I have some code like :
BEGIN
Code generation exception
EXCEPTION
  WHEN OTHERS THEN Log_Error();
END;

The Log_Error function would be able to get the exception context / parameters to log the exception parameters into a table.
Is there any way to manage this without providing the Exception parameters as parameters to the Log_Error function ?

Thanks,
Patrick

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Function for Exception Logging
@ 2018-10-29 17:13 Patrick FICHE <Patrick.Fiche@aqsacom.com>
  2018-10-31 06:45 ` Re: Function for Exception Logging Tony Shelver <tshelver@gmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Patrick FICHE @ 2018-10-29 17:13 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

Hi community,

I would like to implement a function that would log managed Exceptions into a dedicated table.
For example, I have some code like :
BEGIN
Code generation exception
EXCEPTION
  WHEN OTHERS THEN Log_Error();
END;

The Log_Error function would be able to get the exception context / parameters to log the exception parameters into a table.
Is there any way to manage this without providing the Exception parameters as parameters to the Log_Error function ?

Thanks,
Patrick


Patrick Fiche
Database Engineer, Aqsacom Sas.
c. 33 6 82 80 69 96
e. patrick.fiche@aqsacom.com<mailto:patrick.fiche@aqsacom.com>

[01-03_AQSA_Main_Corporate_Logo_JPEG_White_Low.jpg]<http://www.aqsacom.com/;

Attachments:

image001.png (image/png, 7.6K) download view image
^ permalink raw reply [nested|flat] 4+ messages in thread

* Re: Function for Exception Logging
  2018-10-29 17:13 Function for Exception Logging Patrick FICHE <Patrick.Fiche@aqsacom.com>
@ 2018-10-31 06:45 ` Tony Shelver <tshelver@gmail.com>
  2018-11-05 13:26   ` Re: Function for Exception Logging Alexey Bashtanov <bashtanov@imap.cc>
  0 siblings, 1 reply; 4+ messages in thread

From: Tony Shelver @ 2018-10-31 06:45 UTC (permalink / raw)
  To: Patrick.Fiche@aqsacom.com; +Cc: pgsql-general@lists.postgresql.org

I'd be interested if there is an answer to this.   The big issue with
writing to a table is the interaction with rollbacks and commits.

Even more difficult in PG functions as they have no commit / rollback
capability.  I haven't played with stored procedures in in PG11 yet.

In Oracle, I wrote logging / error messages to a logging file on the fire
system, directly from PL/SQL.


This file can then be monitored for error messages via a messaging
solutions.


Regards



On Mon, 29 Oct 2018 at 19:13, Patrick FICHE <Patrick.Fiche@aqsacom.com>
wrote:

> Hi community,
>
>
>
> I would like to implement a function that would log managed Exceptions
> into a dedicated table.
>
> For example, I have some code like :
>
> BEGIN
>
> Code generation exception
>
> EXCEPTION
>
>   WHEN OTHERS THEN Log_Error();
>
> END;
>
>
>
> The Log_Error function would be able to get the exception context /
> parameters to log the exception parameters into a table.
>
> Is there any way to manage this without providing the Exception parameters
> as parameters to the Log_Error function ?
>
>
>
> Thanks,
>
> Patrick
>
>
>
>
>
> *Patrick Fiche*
>
> Database Engineer, Aqsacom Sas.
>
> *c.* 33 6 82 80 69 96
>
> *e.* patrick.fiche@aqsacom.com
>
>
>
> [image: 01-03_AQSA_Main_Corporate_Logo_JPEG_White_Low.jpg]
> <http://www.aqsacom.com/;
>
>
>

Attachments:

image001.png (image/png, 7.6K) download view image
image001.png (image/png, 7.6K) download view image
^ permalink raw reply [nested|flat] 4+ messages in thread

* Re: Function for Exception Logging
  2018-10-29 17:13 Function for Exception Logging Patrick FICHE <Patrick.Fiche@aqsacom.com>
  2018-10-31 06:45 ` Re: Function for Exception Logging Tony Shelver <tshelver@gmail.com>
@ 2018-11-05 13:26   ` Alexey Bashtanov <bashtanov@imap.cc>
  0 siblings, 0 replies; 4+ messages in thread

From: Alexey Bashtanov @ 2018-11-05 13:26 UTC (permalink / raw)
  To: Tony Shelver <tshelver@gmail.com>; Patrick.Fiche@aqsacom.com; +Cc: pgsql-general@lists.postgresql.org


> Even more difficult in PG functions as they have no commit / rollback 
> capability.  I haven't played with stored procedures in in PG11 yet.

You can simulate oracle autonomous transaction feature in postgres by 
connecting to the same db using dblink.

As for implicit passing of error parameters, I don't think it's possible.

Best, Alex




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2018-11-05 13:26 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-10-29 17:02 Function for Exception Logging Patrick FICHE <Patrick.Fiche@aqsacom.com>
2018-10-29 17:13 Function for Exception Logging Patrick FICHE <Patrick.Fiche@aqsacom.com>
2018-10-31 06:45 ` Tony Shelver <tshelver@gmail.com>
2018-11-05 13:26   ` Alexey Bashtanov <bashtanov@imap.cc>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox