insert two tables taking serial from table1

From: "Jim (s/nosp(at)m/(at)/ to reply)" <user725nosp(at)marpadeck(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: insert two tables taking serial from table1
Date: 2002-09-28 01:17:11
Message-ID: rq7l9.472105$_91.685798@rwcrnsc51.ops.asp.att.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I've been looking around for a way to set up an insert to table 1 then take
the serial from table 1 that autoincrimented and add it to table 2. I've
seen ways people have done it by grabbing last row of the table but I am
concerned about a connection that doesn't need to add to table 2 inserting
into the last table before table 1 can be queried. and thus getting the
relation to the wrong row. Is there a way to get the oid from the insert?
using php incase that helps.

thought about doing an exact search on what was just inserted but table has
possibility of users adding exactly the same data. have thought about
combining the tables but don't want an overgrown table with more rows then I
can maneuver through.

thanks in advance for any help.
Jim

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Mark Kirkwood 2002-09-28 01:38:52 Re: Performance while loading data and indexing
Previous Message Joe Conway 2002-09-28 00:08:31 Re: DBLink problems