Re: plperl error format vs plpgsql error format vs pgTAP

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Kevin Field <kevinjamesfield(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: plperl error format vs plpgsql error format vs pgTAP
Date: 2009-05-28 19:22:29
Message-ID: 27547.1243538549@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Kevin Field <kevinjamesfield(at)gmail(dot)com> writes:
> I use pgTAP to make sure my functions produce the correct errors using
> throws_ok(). So when I get an error from a plpgsql function, it looks
> like this:

> ERROR: upper bound of FOR loop cannot be null
> CONTEXT: PL/pgSQL function "foo" line 35 at FOR with integer loop
> variable

> ...which I can then test using throws_ok by giving it the string
> 'upper bound of FOR loop cannot be null'.

Surely, this is a completely brain-dead approach to testing errors
in the first place ... what will happen in a localized installation?

What you need is a test that looks at the SQLSTATE code, and little
if anything else.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2009-05-28 19:28:40 Re: plperl error format vs plpgsql error format vs pgTAP
Previous Message Greg Stark 2009-05-28 19:20:00 Re: search_path vs extensions