From: | Stuart Bishop <stuart(at)stuartbishop(dot)net> |
---|---|
To: | daniel(dot)cruz(at)sistemafiesc(dot)com(dot)br |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Is there a way to add a detail message in a warning with pl/Python? |
Date: | 2013-01-31 07:28:37 |
Message-ID: | CADmi=6Pb3G5jEG-dZnAVBnQgbZt6oKirCfsTrw=_c4UvPXRzUQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Tue, Jan 29, 2013 at 8:03 PM, DANIEL CRISTIAN CRUZ
<daniel(dot)cruz(at)sc(dot)senai(dot)br> wrote:
> Hello,
>
> I build a function and added some warnings where the id of the affected
> rows are inside it; and would be nice to put it into a detail, not in
> the message, since pgbadger can group it and I can see clearly what is
> wrong in my cluster.
>
> I read the manual and tried something with no success:
>
> plpy.warning('test', 'detail') -> output both values
> plpy.warning({'message': 'test', 'detail': 'detail'}) -> output the dict
> plpy.warning('test', detail='detail') -> fail
>
> Am I missing something?
>
> I would read the code, but I had no time right now...
You might be able to get it for errors by raising plpy.SPIError(error,
detail), but that doesn't help for warnings. I think for warnings you
would need to write a helper in PL/pgSQL or similar and use it to log
the warnings using plpy.prepare/plpy.execute.
--
Stuart Bishop <stuart(at)stuartbishop(dot)net>
http://www.stuartbishop.net/
From | Date | Subject | |
---|---|---|---|
Next Message | Craig Ringer | 2013-01-31 08:39:54 | AT TIME ZONE and interval arguments |
Previous Message | Vincent Veyron | 2013-01-31 07:07:30 | Re: Optimizing query? |