No Exception thrown when there is a constraint violation, and delete fails

From: "Nicholas Veeser" <Nicholas(dot)Veeser(at)plumtree(dot)com>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: No Exception thrown when there is a constraint violation, and delete fails
Date: 2004-03-02 21:41:11
Message-ID: 66EA32F2A81C004AB67268BA33833EA00A8CF5@corpexch05.plumtree.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc


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".

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Tim Pizey 2004-03-03 00:10:35 Melati version 0.7.2
Previous Message Sean Elliott 2004-03-02 17:07:35 Passing parameters to functions from Java