X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id BEDD29F946D for ; Thu, 4 May 2006 10:14:04 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 48600-05 for ; Thu, 4 May 2006 10:13:45 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mpiib-berlin.mpg.de (mail.MPIIB-Berlin.MPG.DE [141.14.152.25]) by postgresql.org (Postfix) with SMTP id B07289FAD5A for ; Thu, 4 May 2006 10:13:44 -0300 (ADT) Received: (qmail 5651 invoked by uid 991); 4 May 2006 13:13:41 -0000 Received: from 141.14.153.9 by mail.mpiib-berlin.mpg.de (envelope-from , uid 994) with qmail-scanner-1.25st (sweep: 2.30.5/3.94.0. spamassassin: 3.0.4. perlscan: 1.25st. Clear:RC:1(141.14.153.9):. Processed in 2.821214 secs); 04 May 2006 13:13:41 -0000 X-Qmail-Scanner-Mail-From: boehme@mpiib-berlin.mpg.de via mail.mpiib-berlin.mpg.de X-Qmail-Scanner: 1.25st (Clear:RC:1(141.14.153.9):. Processed in 2.821214 secs Process 5632) Received: from unknown (HELO [141.14.153.9]) (141.14.153.9) by mail.mpiib-berlin.mpg.de with SMTP; Thu, 04 May 2006 15:13:38 +0200 Message-ID: <4459FE02.6020606@mpiib-berlin.mpg.de> Date: Thu, 04 May 2006 15:13:38 +0200 From: Martina Organization: MPIIB User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: Transaction foreign key violation Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/7 X-Sequence-Number: 15135 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