On 7/25/06, Kenneth Downs <[EMAIL PROTECTED]> wrote:
craigp wrote:

>1) does it make sense (and would it be possible) to make a rule which would,
>say, somehow write into the oid field of a tuple to be returned by lastoid? i'm
>assuming here that the database would not have oid's enabled.
>
>
>
We do this in a trigger.  We assign the NEXTVAL to a variable, write
that to the row, then raise its value as a notice.  Then we just
retrieve the notice.

another way to to this is make a dynamic plpgsql function that takes
an insert statement and sequence name as parameters and returns the
currval on the way out.  to the op I would suggest that you can inline
currval into insert statements following the original insert e.g.

insert into master default values;
insert into detail(currval('master_id_seq'), foo, bar);

merlin

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Reply via email to