Re: spi and error messages

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: spi and error messages
Дата
Msg-id 20070530141349.GA76707@winnie.fuhr.org
обсуждение исходный текст
Ответ на spi and error messages  ("Bart Degryse" <Bart.Degryse@indicator.be>)
Ответы perlu: did I find a bug, or did I make one?  ("Bart Degryse" <Bart.Degryse@indicator.be>)
Список pgsql-sql
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?