Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aghJb-0007MU-CS for pgsql-bugs@arkaria.postgresql.org; Thu, 17 Mar 2016 23:26:51 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1aghJa-00058Z-VM for pgsql-bugs@arkaria.postgresql.org; Thu, 17 Mar 2016 23:26:51 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1aghJa-00058R-IR for pgsql-bugs@postgresql.org; Thu, 17 Mar 2016 23:26:50 +0000 Received: from hogranch.com ([75.101.82.47]) by makus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aghJY-0007nN-1p for pgsql-bugs@postgresql.org; Thu, 17 Mar 2016 23:26:49 +0000 Received: from [192.168.0.2] (porker [192.168.0.2]) by hogranch.com (8.11.6/8.11.6) with ESMTP id u2HNQh711801; Thu, 17 Mar 2016 16:26:43 -0700 Subject: Re: Help To: Ritanjali M , pgsql-bugs@postgresql.org References: From: John R Pierce Message-ID: <56EB3D34.3040003@hogranch.com> Date: Thu, 17 Mar 2016 16:26:44 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-HawgScanner-Information: Please contact the ISP for more information X-HawgScanner: Found to be clean X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org On 3/17/2016 6:48 AM, Ritanjali M wrote: > > I am new to PostgreSQL ,i want to insert record into multiple table in > a single transaction and i need to get identity value from first table > and need to insert into second table with same transaction,so please > help me out with example. > this is not a bug, and shouldn't be sent to the pgsql_bugs reporting mail list. you probably want to subscribe to and post to the pgsql-general email list for these sorts of questions.... but, you would do something like.. begin; insert into firsttable ..... returning id; insert into secondtable .... values (....including 'id' value returned by previous query...); commit; its up to your application program making these calls to accept the return value of the first insert and include it in the 2nd insert, the specifics of doing that are programming language and sql binding specific. -- john r pierce, recycling bits in santa cruz -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs