IIRC, certain kinds of pg errors trigger exceptions that can only be caught
with an eval wrapper.  Not sure, but the DBD::Pg module may just be
parroting the bail-out behavior of the backend.

Regards,
Ed Loehr

Jeffrey wrote:
> 
> Hi,
> 
> I am having trouble catching errors from postgress. I am connecting to the
> database via perl and DBI.pm The following will work
> 
> ($dbh = DBI->connect("$dsn", "", "") ) or (print $DBI::errstr and exit());
> 
> But this wont (from deliberately spelled wrong)
> ($sth=$dbh->prepare("select * form tablename")) || (
>     # error
>     print "\nError".$dbh->errstr
>     # error
>     );
> 
> Actually it will work from a telnet prompt, but if I run this script in a
> cgi, it writes the error to the error log instead of the standard out. It
> does not execute the code inside the error comments.
> 
> Thank you for your help
> Jeff Seese

Reply via email to