Exception messages -> application?

From: Frank Miles <fpm(at)u(dot)washington(dot)edu>
To: pgsql-general(at)postgresql(dot)org
Subject: Exception messages -> application?
Date: 2008-04-04 19:02:20
Message-ID: Pine.LNX.4.64.0804041145570.12614@homer21.u.washington.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bhat, Suma 2008-04-04 19:06:42 Upgrading from 8.2.0 to 8.3.1
Previous Message Craig Ringer 2008-04-04 19:01:13 Re: Conversion to 8.3