Skip site navigation (1) Skip section navigation (2)

PL/pgSQL

From: Bob(dot)Henkel(at)hartfordlife(dot)com
To: pgsql-general(at)postgresql(dot)org
Subject: PL/pgSQL
Date: 2004-03-31 17:58:38
Message-ID: OF3760927C.094DFA34-ON86256E68.0062167B-86256E68.0062AF2E@hartfordlife.com (view raw or flat)
Thread:
Lists: pgsql-general
Below is the info from the on-line docs for 7.4.2.  Can someone tell me how
to hook into the error mechanism to notice that this happens. Like the doc
says you can.

I want to do something special in PL/pgSQL if I notice an error has been
encountered. Like log to a table. I know you could do this in the calling
language C++,VB or whatever your app is written in. I would just like to
have this implemented in PL/pgSQL for many reasons.  Like Oracle, Firebird,
Interbase and everyone else does.

If PL/pgSQL had that I would be 100% happy with PostgreSQL instead of 99%
happy(not that anyone cares about my happiness). That's why I'm willing to
do something about this if I can only get some help and guidance on doing
this.   Any  coders out there want to help me out on figuring this out or
adding this to the PostgreSQL source for all to use and enjoy?  To me this
is always that one thing that PostgerSQL doesn't have that I think is not a
plus but a needed piece of functionality.

Thanks



23.8.1. Exceptions


PostgreSQL does not have a very smart exception handling model. Whenever
the parser, planner/optimizer or executor decide that a statement cannot be
processed any longer, the whole transaction gets aborted and the system
jumps back into the main loop to get the next query from the client
application.


It is possible to hook into the error mechanism to notice that this
happens. But currently it is impossible to tell what really caused the
abort (input/output conversion error, floating-point error, parse error).
And it is possible that the database backend is in an inconsistent state at
this point so returning to the upper executor or issuing more commands
might corrupt the whole database.


Thus, the only thing PL/pgSQL currently does when it encounters an abort
during execution of a function or trigger procedure is to write some
additional NOTICE level log messages telling in which function and where
(line number and type of statement) this happened. The error always stops
execution of the function.


Bob Henkel          651-738-5085
Mutual Funds I/T Woodbury
Hartford Life
500 Bielenberg Drive
Woodbury, MN 55125




*************************************************************************
PRIVILEGED AND CONFIDENTIAL: This communication, including attachments, is for the exclusive use of addressee and may contain proprietary, confidential and/or privileged information.  If you are not the intended recipient, any use, copying, disclosure, dissemination or distribution is strictly prohibited.  If you are not the intended recipient, please notify the sender immediately by return e-mail, delete this communication and destroy all copies.
*************************************************************************


Responses

pgsql-general by date

Next:From: Tom LaneDate: 2004-03-31 18:03:40
Subject: Re: Question about rtrees (overleft replacing left in nodes)
Previous:From: Tom LaneDate: 2004-03-31 17:55:40
Subject: Re: Question about rtrees (overleft replacing left in nodes)

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group