pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Martina <boehme@mpiib-berlin.mpg.de>
To: pgsql-jdbc@postgresql.org
Subject: Transaction foreign key violation
Date: Thu, 04 May 2006 15:13:38 +0200
Message-ID: <4459FE02.6020606@mpiib-berlin.mpg.de> (raw)


I'm getting a foreign key constraint violation if I run a transaction in 
which the first statement inserts a new row in Table1 (with serial as 
pk, "idTable1") and the second statement gets this "idTable1" as a fk. 
Because it is not there yet (but in the same transaction) I get this 
error. If I don't use transaction it is working.
What can I do?
This fk constraint is set DEFERRABLE INITIALLY DEFERRED. I tried "SET 
TRANSACTION ISOLATION LEVEL SERIALIZABLE" (just with query.execute() 
before the other statements)) - no luck. If I commit the statements via 
pgAdmin with BEGIN; INSERT INTO ..; COMMIT; it is working fine.
I use 8.1-405 JDBC3

Thanks for suggestions!
Martina




view thread (2+ messages)  latest in thread

Message-ID: <4459FE02.6020606@mpiib-berlin.mpg.de>
Permalink:  ../4459FE02.6020606@mpiib-berlin.mpg.de/
Also on:    postgresql.org/message-id/4459FE02.6020606@mpiib-berlin.mpg.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: boehme@mpiib-berlin.mpg.de
  Subject: Re: Transaction foreign key violation
  In-Reply-To: <4459FE02.6020606@mpiib-berlin.mpg.de>
  References: <4459FE02.6020606@mpiib-berlin.mpg.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox