DaVinci wrote:
> Hi all.
>
> I want to create a new tuple of main info and detail tuples (in
> different tables) that are joined by a key field. Key field is created by
> generator automatically and I need that number in order to assign to detail
> tuples. How can I to get that number in a safe way?.
A successful INSERT returns the oid of the row just created; so get the
new value with a query like this:
SELECT key_field FROM table WHERE oid = new_oid_value;
In libpq programming, use PQoidValue() to get the oid. Other interfcaes
should have equivalent methods.
--
Oliver Elphick Oliver.Elphick@lfix.co.uk
Isle of Wight http://www.lfix.co.uk/oliver
PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47 6B 7E 39 CC 56 E4 C1 47
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"When I consider thy heavens, the work of thy fingers,
the moon and the stars, which thou hast ordained; What
is man, that thou art mindful of him? and the son of
man, that thou visitest him? For thou hast made him a
little lower than the angels, and hast crowned him
with glory and honour." Psalms 8:3-5