Re: spi and error messages

Поиск
Список
Период
Сортировка
Искать
От
Michael Fuhr
Тема
Re: spi and error messages
Дата
в 11:14:03
Msg-id
20070530141349.GA76707@winnie.fuhr.org
Ответ на
spi and error messages (Bart Degryse)
Список
Дерево обсуждения
spi and error messages "Bart Degryse" <Bart.Degryse@indicator.be>
Re: spi and error messages Michael Fuhr <mike@fuhr.org>
perlu: did I find a bug, or did I make one? "Bart Degryse" <Bart.Degryse@indicator.be>
Re: perlu: did I find a bug, or did I make one? Tom Lane <tgl@sss.pgh.pa.us>
Re: perlu: did I find a bug, or did I make one? "Bart Degryse" <Bart.Degryse@indicator.be>
On Wed, May 30, 2007 at 09:33:40AM +0200, Bart Degryse wrote:
> In general how should I catch the error message generated if one
> of the spi functions (spi_exec_query, spi_query, spi_fetchrow,
> spi_prepare,...) fails?

In PL/Perl functions you can use eval to catch errors just as you
would in an ordinary Perl script:

eval { do something };
if ($@) { handle the error }

-- 
Michael Fuhr

В списке pgsql-sql по дате отправления
От: Bart Degryse
Дата:
Сообщение: spi and error messages
От: Gerardo Herzig
Дата:
Сообщение: logging amount rows retrieved?
FAQ