X-Original-To: pgsql-bugs-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 46082D8B91 for ; Mon, 12 Sep 2005 07:50:35 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 70021-07 for ; Mon, 12 Sep 2005 10:50:31 +0000 (GMT) Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by svr1.postgresql.org (Postfix) with ESMTP id A9E03D8B2D for ; Mon, 12 Sep 2005 07:50:20 -0300 (ADT) Received: from mainbox.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id A4C9A414949; Mon, 12 Sep 2005 11:50:13 +0100 (BST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id 91CD815F1D; Mon, 12 Sep 2005 11:48:30 +0100 (BST) Received: from mainbox.archonet.com ([127.0.0.1]) by localhost (mainbox [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 22031-05; Mon, 12 Sep 2005 11:48:26 +0100 (BST) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 2B5C215F1C; Mon, 12 Sep 2005 11:48:26 +0100 (BST) Message-ID: <43255CF9.5070301@archonet.com> Date: Mon, 12 Sep 2005 11:48:25 +0100 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Angelo Neuschitzer Cc: pgsql-bugs@postgresql.org Subject: Re: BUG #1864: Strange behavoir of batches References: <20050907165251.35F37F1098@svr2.postgresql.org> <43205847.8050405@archonet.com> <43255496.5020703@jenomics.net> In-Reply-To: <43255496.5020703@jenomics.net> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.058 required=5 tests=[AWL=0.008, FORGED_RCVD_HELO=0.05] X-Spam-Level: X-Archive-Number: 200509/77 X-Sequence-Number: 12817 Angelo Neuschitzer wrote: >>> In my Program there were 3 blocks of inserting done in a row. 5 >>> blocks of >>> insterting per call. >>> >>> first block insterted 93 rows (in table A) >>> >>> second instered 82 rows (in table B) >>> third 2 (in table C) >>> fourth 9 (in table D) >>> [whereas Tables B,C and D have a reference on Table A] >>> >>> fith entered a reference to all 93 rows of (table A) in table (E). >>> >>> in the fith block at row 82 the batch failed because It did not match >>> the >>> foreign key constraint of table A TO table D >> >> >> >> And was this correct or not? Did row 82 reference a valid row in table >> A or not? > > > Was corrrect. the row was not exsistent (afaik. Its very hard to > relocate a row in Table A without a reference in the tables B,C or D) > I also should mention that the first 93 INSERTs had no explainable > order, but were always in the _same_ order. If the foreign-key from table E couldn't find the corresponding row in table A, then it's supposed to raise an error. So - if there is a problem it must have happened when inserting the data into table A. I'm not a Java expert I'm afraid, but there are a couple of things that seem worth checking: 1. Make sure you check the result-codes when inserting these batches. Put some inadmissible data in and check you get an error back. 2. Does the problem go away when you just use single statements within a transaction rather than addBatch() - that would narrow down where the problem is. -- Richard Huxton Archonet Ltd