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

From Tom Lane
Subject Re: Problems handling errors in PL/pgSQL
Date
Msg-id 24242.988070243@sss.pgh.pa.us
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
"Josh Berkus" <josh@agliodbs.com> writes:
> 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.

This would clearly be a bug, but I cannot replicate the problem:

regression=# SELECT fn_save_order_details (7703, '{34,29,40}','{TRUE, TRUE, FALSE}');
ERROR:  <unnamed> referential integrity violation - key referenced from order_details not found in orders
regression=#
        regards, tom lane


pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: pg_dump bug? (7.1)
Next
From: Tom Lane
Date:
Subject: Re: Problems handling errors in PL/pgSQL