From: | Chris Ruprecht <chrup(at)earthlink(dot)net> |
---|---|
To: | pgsql-php(at)postgresql(dot)org |
Subject: | How do I get a recid value from a just inserted record |
Date: | 2002-08-28 03:45:27 |
Message-ID: | 200208272345.27536.chrup@earthlink.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-php |
Hi all,
I have 3 tables (extremely simplified):
a:
a.recid default sequence_a
a.name
b:
b.recid default sequence_b
b.address
b.city
c:
c.recid default sequence_c
c.arecid
c.brecid
each has a default sequence on their respective recid - which is the primary
index.
when I do an "insert into a ...", it automagically assigns recid a new, unique
value, same goes for b.
But to create c, I need to know the recid from a and b, so I can connect the
two.
Is there any way to get the recid from a and b after they have been inserted
like in "insert into a ... and give me the recid you're going to use, back"?
I know, I can do a "netxval('...')" stuff and then insert the records with
values in recid, but that requires two extra calls to the DB per transaction.
Best regards,
Chris
From | Date | Subject | |
---|---|---|---|
Next Message | dr_sad(surguttel) | 2002-08-28 03:51:47 | Where can I get error messages? |
Previous Message | Chris Ruprecht | 2002-08-28 03:42:45 | New PHP/PG Functions |