From: | Frank Miles <fpm(at)u(dot)washington(dot)edu> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Exception messages -> application? |
Date: | 2008-04-06 03:42:34 |
Message-ID: | Pine.LNX.4.64.0804052033350.12474@homer21.u.washington.edu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
>On Fri, Apr 04, 2008 at 12:02:20PM -0700, Frank Miles wrote:
>
>> 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)
>
>psycopg2 does a pretty good job of converting any PostgreSQL
>side exceptions into Python exceptions which are then
>getting raised in your Python code. Unless you explicitely
>silence/catch PG exceptions inside your plpgsql code you
>should be seeing them turn up in Python.
>
>There's a bunch of arguments on the Python exception raised.
>
>try:
> ...
>except TheExceptionType, e:
> print dir(e)
>
>might help with that.
>
>Also, you may need to fiddle with the PG client logging
>settings (in postgresql.conf) which control what level of
>detail of error information is getting sent to the client in
>the first place.
>
>BTW, are you talking about RAISE EXCEPTION or RAISE NOTICE ?
>
>Karsten
Thanks, Karsten. At some point in the forgotten past, I had set up
a DB-handling python class which (among many other things) catches
psycopg exceptions - your guess there was right on the mark. I should
be able to alter that code to fix this problem.
Unfortunately this does not help for lesser events (i.e. NOTICE and WARNING).
My preliminary effort suggests that psycopg isn't passing these. I'll
take a further look at the client logging settings - will these be
sufficient?
Thanks again!
-f
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2008-04-06 03:52:51 | Re: Limiting postgresql resources |
Previous Message | Dee | 2008-04-06 01:03:52 | Re: Cannot Install PostgreSQL on Windows 2000 Server |