Re: Implementation of SQLSTATE and SQLERRM variables

Поиск
Список
Период
Сортировка
От Neil Conway
Тема Re: Implementation of SQLSTATE and SQLERRM variables
Дата
Msg-id 42953D05.2070100@samurai.com
обсуждение исходный текст
Ответ на Re: Implementation of SQLSTATE and SQLERRM variables  (Bruce Momjian <pgman@candle.pha.pa.us>)
Ответы Re: Implementation of SQLSTATE and SQLERRM variables
Re: Implementation of SQLSTATE and SQLERRM variables
Список pgsql-patches
Bruce Momjian wrote:
> Patch applied.

This patch still needs work.

> I added a documentation mention too.

I think the docs need more than just "these variables are set when an
exception is raised".

The patch current resets SQLSTATE and SQLERRM whenever a new block is
entered. So:

create function trap_exceptions() returns void as $_$
begin
    begin
      raise exception 'first exception';
    exception when others then
      raise notice '% %', SQLSTATE, SQLERRM;
      begin
        raise notice '% %', SQLSTATE, SQLERRM;
      end;
    end;
    return;
end; $_$ language plpgsql;

The second RAISE will report "successful completion". Is this the
behavior we want?

Is SQLERRM the best name for that variable? It seems a little obscure to me.

-Neil

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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Implement support for TCP_KEEPCNT, TCP_KEEPIDLE, TCP_KEEPINTVL
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Implementation of SQLSTATE and SQLERRM variables