Re: Re: Advice on stored proc error handling versus Sybase? - Mailing list pgsql-novice

From Tom Lane
Subject Re: Re: Advice on stored proc error handling versus Sybase?
Date
Msg-id 1320.979059916@sss.pgh.pa.us
Whole thread Raw
In response to Re: Advice on stored proc error handling versus Sybase?  (Ken Corey <ken@kencorey.com>)
List pgsql-novice
Ken Corey <ken@kencorey.com> writes:
> Right.  Not what I'm used to, but I'll get over it.  *smile*.  So that
> means that when calling a function using nulls, I have to cast the nulls
> to an appropriate type so that plpgsql can figure out which function I
> mean...messy.

Only if there's not enough information in the other arguments to
uniquely determine which function you mean.

>>>> 3) What if the insert fails?  How can I tell?
>>
>> You don't have to, because the function won't get to execute any further
>> if there's an error.  AFAIK there's not yet any provision for trapping
>> errors in plpgsql.  You might want to try the select first, and only
>> do the insert if the select doesn't find a match.

> Hrm...I must be able to tell *somewhere* that an error happened,
> otherwise how would you ever know if something is wrong or not?

Well, your application gets back an error message, but my point was that
the code of the function itself doesn't get to trap the error.  (Yes,
this could stand to be improved.)

            regards, tom lane

pgsql-novice by date:

Previous
From: Andy Holman
Date:
Subject: Days betwen dates
Next
From: John Burski
Date:
Subject: Comparison Operator problem