"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