Last insert id

From: mixo <mixo(at)coza(dot)net(dot)za>
To: pgsql-sql(at)postgresql(dot)org
Subject: Last insert id
Date: 2004-06-09 06:24:25
Message-ID: 40C6AD19.70302@coza.net.za
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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?

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Peter Eisentraut 2004-06-09 06:36:25 Re: Getting FK relationships from information_schema
Previous Message Tom Lane 2004-06-09 05:04:47 Re: Getting FK relationships from information_schema