Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id EB8489F9B05 for ; Mon, 18 Dec 2006 08:06:20 -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 67640-09 for ; Mon, 18 Dec 2006 08:05:58 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by postgresql.org (Postfix) with SMTP id 1F0079F9C35 for ; Mon, 18 Dec 2006 08:05:55 -0400 (AST) Received: (qmail invoked by alias); 18 Dec 2006 12:05:54 -0000 Received: from ktbl.heagmedianet.de (EHLO PCMELZER) [213.188.107.46] by mail.gmx.net (mp038) with SMTP; 18 Dec 2006 13:05:54 +0100 X-Authenticated: #17979613 From: "Peter Neu" To: Subject: Re: Efficient Insert statement for one record into multiple Date: Mon, 18 Dec 2006 13:05:12 +0100 Message-ID: <01fb01c7229c$c59e0aa0$bcc8a8c0@PCMELZER> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <45867B49.2090905@gmx.net> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 Thread-Index: Accil7JKGFpfHQnPTDK+FZeOvk1BTwABPXEA X-Y-GMX-Trusted: 0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=AWL, BAYES_50, SPF_PASS X-Spam-Level: X-Archive-Number: 200612/83 X-Sequence-Number: 16315 Hi, in my create table statement I got this line: id int4 DEFAULT nextval('public.user_auth_id2_seq'::text) So according to your suggestions this would be insert into B (id_from_a, statistic_data) values( currval("public.user_auth_id2_seq"),bla") ,right? If I got you right I cannot link this two insert statements together. So I need two times to open a prepared statement and execute it. Would I need to do this in a transaction or is it safe to do this without it? Cheers, Pete