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
containproprietary, 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,
pleasenotify the sender immediately by return e-mail, delete this communication and destroy all copies.
*************************************************************************