Re: catch SQLException, error code for Foeign key violation,

From: Kris Jurka <books(at)ejurka(dot)com>
To: "surabhi(dot)ahuja" <surabhi(dot)ahuja(at)iiitb(dot)ac(dot)in>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: catch SQLException, error code for Foeign key violation,
Date: 2006-04-17 23:13:55
Message-ID: Pine.BSO.4.63.0604171812200.11226@leary2.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, 17 Apr 2006, surabhi.ahuja wrote:

> The question is that is from this SQLException can i detect if it is a
> foreign key violation,
>

You should check the value of SQLException.getSQLState() against this
table:
http://www.postgresql.org/docs/8.1/static/errcodes-appendix.html

Kris Jurka

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Peter Wilson 2006-04-18 00:13:13 Re: plpgsql replication stored procedure
Previous Message Teodor Sigaev 2006-04-17 20:56:16 Re: tsearch partial word