Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 826DD2E0068 for ; Wed, 20 Feb 2008 08:28:55 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 37912-05-3 for ; Wed, 20 Feb 2008 08:28:46 -0400 (AST) Received: from mail01.enterprisedb.com (mail01.enterprisedb.com [63.246.7.168]) by postgresql.org (Postfix) with ESMTP id D28C92E007A for ; Wed, 20 Feb 2008 08:28:42 -0400 (AST) thread-index: AchzvDRumTvUwcghTjKfY5IKjw1PDg== Received: from [192.168.1.33] ([81.109.253.218]) by mail01.enterprisedb.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Wed, 20 Feb 2008 07:29:13 -0500 Content-Class: urn:content-classes:message Importance: normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.4133 Message-ID: <47BC1CB6.6070007@enterprisedb.com> Date: Wed, 20 Feb 2008 12:27:34 +0000 From: "Heikki Linnakangas" Organization: EnterpriseDB User-Agent: Mozilla-Thunderbird 2.0.0.9 (X11/20080110) MIME-Version: 1.0 To: "Paul Tomblin" Cc: Subject: Re: Retrieving last InsertedID : INSERT... RETURNING safe ? References: <38245.1203500677@motionsponsor.com> <47BC0AF6.2060500@enterprisedb.com> <87prurrh87.fsf@mnc.ch> <55C92F71-0317-4E91-A092-C22A7A2F1FD8@fastcrypt.com> <47BC1AC4.5010809@gmail.com> In-Reply-To: <47BC1AC4.5010809@gmail.com> Content-Type: text/plain; format=flowed; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 20 Feb 2008 12:29:13.0703 (UTC) FILETIME=[339CF770:01C873BC] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200802/162 X-Sequence-Number: 18369 Paul Tomblin wrote: > Dave Cramer wrote: >>> Well, that other solution is dangerous in case multiple inserts >>> to that table are done concurrently; a quite common usage pattern >>> with java web applications handling multiple HTTP requests with >>> concurrent java threads.. >>> >> No it is not dangerous. It is the right way to do it. There is >> absolutely no danger in using currval in this manner. > > Unless you have autocommit on. No, autocommit has nothing to do with it. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com