Transaction foreign key violation

From: Martina <boehme(at)mpiib-berlin(dot)mpg(dot)de>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Transaction foreign key violation
Date: 2006-05-04 13:13:38
Message-ID: 4459FE02.6020606@mpiib-berlin.mpg.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc


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

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Dave Cramer 2006-05-04 15:08:53 Re: Bug with callable statement and output parameters
Previous Message surabhi.ahuja 2006-05-04 06:09:10 code to cancel a running query, worker thread