Stored Function EXCEPTION detection by Perl using DBI

From: Rich Hall <rhall(at)micropat(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Stored Function EXCEPTION detection by Perl using DBI
Date: 2004-03-24 17:27:43
Message-ID: 4061C50F.7030600@micropat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-general by date

  From Date Subject
Next Message Bill Moran 2004-03-24 18:03:47 Re: partial VACUUM FULL
Previous Message Steve Wampler 2004-03-24 17:05:00 Perl DBIx::SearchBuilder and pg_atoi: zero-length string?