Stored Function EXCEPTION detection by Perl using DBI - Mailing list pgsql-general

From Rich Hall
Subject Stored Function EXCEPTION detection by Perl using DBI
Date
Msg-id 4061C50F.7030600@micropat.com
Whole thread Raw
List pgsql-general
Thisa is probably the wrong forum for this question. But perhaps I could
be pointed to the correct forum.

I am  in the final stages of converting an Oracle database to
PostgreSQL. I have just received the Perl script which will drive the
application and call my stored functions.

When the stored functions succeed, everythng runs well. My issue is with
having the Perl script react appropriately to problems with the stored
functions.

When my functions encounter a non-recoveralbe error they should not
commit, so they fire off a RAISE EXCEPTION.

But the Perl script gets more than what my stored function sent by RAISE
EXCEPTION.

As a test I created this function: (this is the operative code for the
function, not the DDL)
    BEGIN
        RAISE EXCEPTION 'IMMEDIATE FALSE FAILURE';
    END;

Upon encountering an error, the Perl script dumps the string returned by
the DBI function errstr. ( print( $sth->errstr() . "\n"; )

This is what gets "print"ed:

ERROR:  IMMEDIATE FALSE FAILURE (SQL-HY000)
ERROR:  IMMEDIATE FALSE FAILURE (SQL-08S01)(DBD: st_execute/SQLExecute
err=-1)

What is contributed by PostgreSQL besides my error string? e.g.
"IMMEDIATE FALSE FAILURE"
Is the rest, as I suspect, a DBI/DBD issue?

Can I be pointed to documentation specific to the PostgreSQL DBD driver


Rick



pgsql-general by date:

Previous
From: Steve Wampler
Date:
Subject: Perl DBIx::SearchBuilder and pg_atoi: zero-length string?
Next
From: Bill Moran
Date:
Subject: Re: partial VACUUM FULL