Re: Problems handling errors in PL/pgSQL

Поиск
Список
Период
Сортировка
От Joe Conway
Тема Re: Problems handling errors in PL/pgSQL
Дата
Msg-id 038201c0cc4a$ca55f110$96d410ac@jecw2k1
обсуждение исходный текст
Ответ на Problems handling errors in PL/pgSQL  ("Josh Berkus" <josh@agliodbs.com>)
Ответы Re: Problems handling errors in PL/pgSQL  ("Josh Berkus" <josh@agliodbs.com>)
Список pgsql-sql
> However, not all types of errors are so trapped.  The most problematic
> un-trapped error is referential integrity:  if an INSERT or UPDATE fails
> because of a referential integrity violation, the PL/pgSQL function will
> still see the statement as a success and not error out.  Example:
>

I'm not sure if this is what you're looking for, but in 7.1 you can do
something like:
   INSERT INTO bar(barpk,foopk) VALUES(barpkval,foopkval);   GET DIAGNOSTICS rows = ROW_COUNT;   -- do something based
onrows --
 

See "24.2.5.4. Obtaining other results status" at
http://postgresql.readysetnet.com/users-lounge/docs/7.1/postgres/plpgsql-des
cription.html.

Hope this helps,

Joe





В списке pgsql-sql по дате отправления:

Предыдущее
От: "Josh Berkus"
Дата:
Сообщение: Problems handling errors in PL/pgSQL
Следующее
От: "Josh Berkus"
Дата:
Сообщение: Re: Problems handling errors in PL/pgSQL