Re: exception handling in plperlu

From: "Jasbinder Singh Bali" <jsbali(at)gmail(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: exception handling in plperlu
Date: 2007-03-16 02:06:06
Message-ID: a47902760703151906t597d8a1cy1087e2058803bff5@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

How about using a try catch block?
isn't that more efficient that eval?

~Jas

On 3/15/07, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> "Jasbinder Singh Bali" <jsbali(at)gmail(dot)com> writes:
> > Actually, if I rephrase my requirement, I need to catch an exception at
> any
> > point ,where ever it is raised, in the perl code.
> > E.g during an insert, there is a foreign key contraint violation, then i
> > need to catch this specific error and do something with it.
>
> Since PG 8.0, you should be able to trap exceptions with eval{}, same as
> you would do in any Perl code.
>
> regards, tom lane
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2007-03-16 02:08:40 Re: pg_dump warning format?
Previous Message Tom Lane 2007-03-16 01:56:59 Re: exception handling in plperlu