Exception messages -> application? - Mailing list pgsql-general

From Frank Miles
Subject Exception messages -> application?
Date
Msg-id Pine.LNX.4.64.0804041145570.12614@homer21.u.washington.edu
Whole thread Raw
Responses Re: Exception messages -> application?  (Karsten Hilbert <Karsten.Hilbert@gmx.net>)
List pgsql-general
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

pgsql-general by date:

Previous
From: "Shahaf Abileah"
Date:
Subject: creating a temp table in a function
Next
From: Andreas 'ads' Scherbaum
Date:
Subject: Re: creating a temp table in a function