Re: how to emit line number in a function?

Поиск
Список
Период
Сортировка
От Jerry Sievers
Тема Re: how to emit line number in a function?
Дата
Msg-id m3ek5w4hmo.fsf@prod01.jerrysievers.com
обсуждение исходный текст
Ответ на how to emit line number in a function?  (Bricklen Anderson <BAnderson@PresiNET.com>)
Ответы Re: how to emit line number in a function?  (Bricklen Anderson <BAnderson@PresiNET.com>)
Список pgsql-general
Bricklen Anderson <BAnderson@presinet.com> writes:

> I couldn't find any useful references in the docs or archives for emitting the
> line number of a plpgsql function (in a RAISE statement). I'd like to use it for
> debugging some complex functions.
> Does anyone have any tips on where to look, or an example of this?

Have a look at the m4 macro processor

changequote({,})dnl
define({func_body},{$$begin
    raise exception 'I barfed on line #__line__';
end$$})dnl

create function some_func()
returns whatever
as func_body
language plpgsql;

This can be useful sometimes... but may ADD to your debugging
headaches if not used artfully!

HTH

--
-------------------------------------------------------------------------------
Jerry Sievers   305 854-3001 (home)     WWW ECommerce Consultant
                305 321-1144 (mobile    http://www.JerrySievers.com/

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

Предыдущее
От: Richard van den Berg
Дата:
Сообщение: Using native win32 psql.exe using alternative cygwin terminal
Следующее
От: vishal saberwal
Дата:
Сообщение: Re: Image File System Question