parsing SQLERRM ?

Поиск
Список
Период
Сортировка
От
Тема parsing SQLERRM ?
Дата
Msg-id F3CBFBA88397EA498B22A05FFA9EC49D8BE0D4E0@MX22A.corp.emc.com
обсуждение исходный текст
Ответы Re: parsing SQLERRM ?  ("Albe Laurenz" <laurenz.albe@wien.gv.at>)
Список pgsql-general
(version == 9.1)
 
In my PL/pgSQL stored functions,
I want to be able to distinguish which FK-constraint caused the [foreign_key_violation] exception.
  . . .
  BEGIN
    delete from MY_COOL_TABLE where id = 123 ;
  EXCEPTION
    WHEN foreign_key_violation THEN
      CASE
        WHEN (SQLERRM tells me it blew up because of FK X)  THEN . . . ;
        WHEN (SQLERRM tells me it blew up because of FK Y)  THEN . . . ;
        WHEN (SQLERRM tells me it blew up because of FK Z)  THEN . . . ;
      END;
    WHEN others THEN
      raise;
  END;
  . . .
 
Is a "robust enough" parsing of SQLERRM actually the best/only way to determine this ?
 
-dvs-
 

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

Предыдущее
От: John R Pierce
Дата:
Сообщение: Re: Empty arrays vs. NULLs, 9.1 & 8.3
Следующее
От: Guillaume Lelarge
Дата:
Сообщение: Re: Is there a way to ask PostgreSQL for the name of the computer it's running on?