Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id DB9E09F9F46 for ; Tue, 19 Dec 2006 07:09:39 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-new, port 10024) with ESMTP id 33206-04-2 for ; Tue, 19 Dec 2006 07:09:16 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by postgresql.org (Postfix) with SMTP id 6EF079F9FB2 for ; Tue, 19 Dec 2006 07:09:20 -0400 (AST) Received: (qmail 9117 invoked from network); 19 Dec 2006 11:09:19 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.14?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 19 Dec 2006 11:09:19 -0000 In-Reply-To: <00f201c72357$0ba220d0$bcc8a8c0@PCMELZER> References: <00f201c72357$0ba220d0$bcc8a8c0@PCMELZER> Mime-Version: 1.0 (Apple Message framework v752.3) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <30DA21B9-0758-4A54-BC35-D955A2D95B83@fastcrypt.com> Cc: , "'Roland Walter'" Content-Transfer-Encoding: 7bit From: Dave Cramer Subject: Re: Efficient Insert statement for one record into multiple Date: Tue, 19 Dec 2006 06:09:47 -0500 To: Peter Neu X-Mailer: Apple Mail (2.752.3) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200612/94 X-Sequence-Number: 16326 If you create the key using nextval you will never get duplicate key exceptions. However, you should never close connections in the catch clause. Always close connections in a finally clause. Dave On 19-Dec-06, at 5:18 AM, Peter Neu wrote: > Hello, > > the insertion within the same connection objects works just fine. ;o) > One thing which still keeps me thinking is how should I handle > duplicate > key exceptions when it happens in the first insert? Should I just > close > the connection object in the catch clause when this happens in the > first > statement so the second statement hits an > AlreadyClosedConnectionException? > > Cheers, > Pete > > > > ---------------------------(end of > broadcast)--------------------------- > TIP 1: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that > your > message can get through to the mailing list cleanly >