Re: Problems handling errors in PL/pgSQL - Mailing list pgsql-sql

From Joe Conway
Subject Re: Problems handling errors in PL/pgSQL
Date
Msg-id 038201c0cc4a$ca55f110$96d410ac@jecw2k1
Whole thread Raw
In response to Problems handling errors in PL/pgSQL  ("Josh Berkus" <josh@agliodbs.com>)
Responses Re: Problems handling errors in PL/pgSQL
List pgsql-sql
> However, not all types of errors are so trapped.  The most problematic
> un-trapped error is referential integrity:  if an INSERT or UPDATE fails
> because of a referential integrity violation, the PL/pgSQL function will
> still see the statement as a success and not error out.  Example:
>

I'm not sure if this is what you're looking for, but in 7.1 you can do
something like:
   INSERT INTO bar(barpk,foopk) VALUES(barpkval,foopkval);   GET DIAGNOSTICS rows = ROW_COUNT;   -- do something based
onrows --
 

See "24.2.5.4. Obtaining other results status" at
http://postgresql.readysetnet.com/users-lounge/docs/7.1/postgres/plpgsql-des
cription.html.

Hope this helps,

Joe





pgsql-sql by date:

Previous
From: "Josh Berkus"
Date:
Subject: Problems handling errors in PL/pgSQL
Next
From: "Josh Berkus"
Date:
Subject: Re: Problems handling errors in PL/pgSQL