Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

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


  • From: Kris Jurka <books(at)ejurka(dot)com>
  • To: "surabhi.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: Mon, 17 Apr 2006 18:13:55 -0500 (EST)
  • Message-id: <Pine(dot)BSO(dot)4(dot)63(dot)0604171812200(dot)11226(at)leary2(dot)csoft(dot)net>



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



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group