Re: Problems handling errors in PL/pgSQL

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Josh Berkus" <josh(at)agliodbs(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Problems handling errors in PL/pgSQL
Date: 2001-04-23 23:57:23
Message-ID: 24242.988070243@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

"Josh Berkus" <josh(at)agliodbs(dot)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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Josh Berkus 2001-04-24 00:15:43 Re: Problems handling errors in PL/pgSQL
Previous Message Tom Lane 2001-04-23 23:36:49 Re: pg_dump bug? (7.1)