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

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Reply via email to