Re: How to debug pl/pgSQL -script?

From: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
To: "Henriksen, Jonas F" <jonas(dot)f(dot)henriksen(at)imr(dot)no>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to debug pl/pgSQL -script?
Date: 2004-10-01 13:28:31
Message-ID: 20041001132830.GA5175@dcc.uchile.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Oct 01, 2004 at 03:05:14PM +0200, Henriksen, Jonas F wrote:

> I'm writing some simple triggers and functions for a postgres
> database, and I'm wondering how to go about to debug a
> pl/pgSQL-script. Is there a way to echo variable-content to screen, or
> to file? Or is there other, more advanced ways of debugging such
> scripts?

Yes, use RAISE NOTICE. See the docs -- it takes a string which can have
% in them, like printf %-escapes but without the modifiers.

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"Postgres is bloatware by design: it was built to house
PhD theses." (Joey Hellerstein, SIGMOD annual conference 2002)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Kevin Barnard 2004-10-01 14:26:43 Re: newby question
Previous Message ra 2004-10-01 13:21:27 Re: How to debug pl/pgSQL -script?