Re: plpgsql debugging

From: Richard Huxton <dev(at)archonet(dot)com>
To: Andreas Pflug <pgadmin(at)pse-consulting(dot)de>
Cc: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: plpgsql debugging
Date: 2003-09-08 18:48:16
Message-ID: 200309081948.16724.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Monday 08 September 2003 17:14, Andreas Pflug wrote:
> Richard Huxton wrote:
> >Actually, a simple trace ability would be a huge step forward. It'd save
> > me dotting RAISE statements around my functions while I write them.
>
> Sounds bloody familiar... :-(
>
> > Even the ability to add DEBUG statements that checked some global flag
> > before firing would be very useful (to me at least).
>
> I could imagine a DEBUG .... which works like RAISE NOTICE with checking
> for a set variable, and ASSERT which works like RAISE ERROR.
>
> Does anybody expect keyword conflicts from this?

How about a DEBUG block, ideally with a token?

...
DEBUG ''foo''
RAISE NOTICE ''my loop counter is %'',i;
-- any other valid statements here
END DEBUG;
...

=> SET DEBUG_TOKEN='foo';
=> SELECT my_function();

That would let you turn debugging on/off for various modules by token-name,
and let you e.g. check whether there are the expected number of records in
some target table.

Would that impose a horrible performance cost, or would the whole block just
be skipped? (I only ever took a quick look at the plpgsql code)

--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ron Mayer 2003-09-08 18:59:50 Re: ISO 8601 "Time Intervals" of the "format with time-unit deignators"
Previous Message Rod Taylor 2003-09-08 18:45:00 Re: constraint modification on todo list