Re: No Exception thrown when there is a constraint violation, and delete fails - Mailing list pgsql-jdbc

From Paul Thomas
Subject Re: No Exception thrown when there is a constraint violation, and delete fails
Date
Msg-id 20040303091434.C24535@bacon
Whole thread Raw
In response to No Exception thrown when there is a constraint violation, and delete fails  ("Nicholas Veeser" <Nicholas.Veeser@plumtree.com>)
List pgsql-jdbc
On 02/03/2004 21:41 Nicholas Veeser wrote:
>
> I am trying to do a delete, and there seems to be a constraint violation.
> Fine, but why does it not send an exception to let me know this.
> I mean, nothing happens. Not even a warning.
>
> Is there something I need to turn on to find constraint violations as
> exceptions?
>
>
> Code:
> Connection c = DriverManager.getConnection(
> c.setAutoCommit(true);
>
> PreparedStatement pst = c.prepareStatement("delete from queue where
> id=?");
> pst.setInt(1, 850);
> pst.executeUpdate();
>
> c.close();
>
>
> Exception:
> None, not a thing.
>
>
> Error Log:
>
> ERROR:  update or delete on "queue" violates foreign key constraint
> "fkd73c6034ba977309" on "branch_queue"
> DETAIL:  Key (id)=(850) is still referenced from table "branch_queue".

It works for me on every version of PostgreSQL I've tried it on (7.1
onwards).
--
Paul Thomas
+------------------------------+---------------------------------------------+
| Thomas Micro Systems Limited | Software Solutions for the Smaller
Business |
| Computer Consultants         |
http://www.thomas-micro-systems-ltd.co.uk   |
+------------------------------+---------------------------------------------+

pgsql-jdbc by date:

Previous
From: "Akasha"
Date:
Subject: miss decoding issue in pg73jdbc2.jar
Next
From: Sean Elliott
Date:
Subject: Passing date and smallint (etc) parameters to functions from Java