On Sat, 20 Jan 2001, Tom Lane wrote:
> > currval returns error unless nextval has been called at least once in the
> > session.
>
> > I use <seq>.last_value
>
> > Perhaps I'm fooling myself
>
> Yes, you are, unless you never have more than one client attached to
> your database. last_value will return whatever value was last assigned
> by any backend, therefore you might not get the value that was inserted
> into your tuple, but someone else's.
In that case you would call next_val *before* you insert and use that
value in the INSERT statement.
-- Brett
http://www.chapelperilous.net/~bmccoy/
---------------------------------------------------------------------------
Military intelligence is a contradiction in terms.
-- Groucho Marx