Re: how to emit line number in a function?

From: Bricklen Anderson <BAnderson(at)PresiNET(dot)com>
To: Jerry Sievers <jerry(at)jerrysievers(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: how to emit line number in a function?
Date: 2005-11-04 14:51:05
Message-ID: 436B7559.6090904@PresiNET.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Jerry Sievers wrote:
> Bricklen Anderson <BAnderson(at)presinet(dot)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
>
I'll look into that, thanks for the suggestion.

Cheers,

Bricklen

--
_______________________________

This e-mail may be privileged and/or confidential, and the sender does
not waive any related rights and obligations. Any distribution, use or
copying of this e-mail or the information it contains by other than an
intended recipient is unauthorized. If you received this e-mail in
error, please advise me (by return e-mail or otherwise) immediately.
_______________________________

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2005-11-04 14:57:24 Re: Image File System Question
Previous Message Csaba Nagy 2005-11-04 14:49:59 Re: Image File System Question