From: Joe Conway <jconway2@home.com>
To: Josh Berkus <josh@agliodbs.com>
To: pgsql-sql@postgresql.org
Subject: Re: Problems handling errors in PL/pgSQL
Date: Mon, 23 Apr 2001 16:11:53 -0700
Message-ID: <038201c0cc4a$ca55f110$96d410ac@jecw2k1> (raw)
References: <web-43127@davinci.ethosmedia.com>
> 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 on rows --
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: jconway2@home.com, josh@agliodbs.com
Subject: Re: Problems handling errors in PL/pgSQL
In-Reply-To: <038201c0cc4a$ca55f110$96d410ac@jecw2k1>
References: <web-43127@davinci.ethosmedia.com> <038201c0cc4a$ca55f110$96d410ac@jecw2k1>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox