X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3F96BD1B366 for ; Wed, 9 Jun 2004 03:24:37 -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 08538-05 for ; Wed, 9 Jun 2004 06:24:33 +0000 (GMT) Received: from beth.coza.net.za (beth.coza.net.za [206.223.136.193]) by svr1.postgresql.org (Postfix) with ESMTP id 38A9CD1B276 for ; Wed, 9 Jun 2004 03:24:28 -0300 (ADT) Received: from coza.net.za (mixo.coza.net.za [206.223.136.225]) by beth.coza.net.za (8.11.6/8.11.2) with ESMTP id i596OPF28867 for ; Wed, 9 Jun 2004 08:24:26 +0200 Message-ID: <40C6AD19.70302@coza.net.za> Date: Wed, 09 Jun 2004 08:24:25 +0200 From: mixo User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040116 X-Accept-Language: en-us, en, en-gb, en-za MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Last insert id Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200406/65 X-Sequence-Number: 18010 I have three tables which are related a serial field, table1_id, in on of the tables. Updating the tables is done through a transaction. My problem is, once I have insert a row in the first tables with table1_id, I need for the other two tables. How can I get this? Is it safe to use "select max(table1_id) from table1" after the insert?