First of all, many thanks to all the developers for creating such a great DB.
I have a moderately DB-ignorant question: is there a "built-in" way for an
application to receive the message emitted by a RAISE .... in a PgSQL function?
Context: I have a moderately complex application (in python, using psycopg2)
that we use to help guide our research support operations. Occasionally
the application doesn't allow the user to do something because of some
trigger or other PgSQL function has raised an exception. While sometimes the
application can make a plausible conjecture as to the cause, other times
it is necessary to dig through the database logs to read the message emitted
by the server-side DB function. This is frustrating for the users.
Presumably the function could do something like writing the message to
a special-purpose table that the user application could read (but perhaps
only when not in a transaction); or perhaps some sort of notify/listen system
could be set up. What method[s] are generally the best in these circumstances?
It would be best if it didn't require changing all of the PgSQL functions
(ouch!), though that is not impossible.
Thanks for your insightful ideas!
-f