Re: catch SQLException, error code for Foeign key violation, - Mailing list pgsql-general

From Kris Jurka
Subject Re: catch SQLException, error code for Foeign key violation,
Date
Msg-id Pine.BSO.4.63.0604171812200.11226@leary2.csoft.net
Whole thread Raw
In response to catch SQLException, error code for Foeign key violation,  ("surabhi.ahuja" <surabhi.ahuja@iiitb.ac.in>)
List 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

pgsql-general by date:

Previous
From: Teodor Sigaev
Date:
Subject: Re: tsearch partial word
Next
From: Peter Wilson
Date:
Subject: Re: plpgsql replication stored procedure