currval, lastval, nextvar? - Mailing list pgsql-novice

From Carol Walter
Subject currval, lastval, nextvar?
Date
Msg-id E38AF20C-A2CB-4E7C-8CDA-AD06C35E61D0@indiana.edu
Whole thread Raw
Responses Re: currval, lastval, nextvar?  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
Re: currval, lastval, nextvar?  (johnf <jfabiani@yolo.com>)
List pgsql-novice
Hello,

I want write a query that will insert a record in a person table,
insert a record in a presentation table, and then insert a record into
a bridge table that contains the keys of both of the newly created
records from the other two tables.  According to the documentation,
takes the next number in the sequence and reports it.  Both currval
and lastval report the last value that was taken from the sequence,
but both will produce errors if a "nextval" was not called in the
current session.  Does writing a record that automatically updates a
sequence count as calling nextval?

Thanks,
Carol Walter

pgsql-novice by date:

Previous
From: Robert Campbell
Date:
Subject: Re: Workaround for bug #4608?
Next
From: "A. Kretschmer"
Date:
Subject: Re: currval, lastval, nextvar?