Getting Sequence Value

JORGE MALDONADO <[email protected]>
Newsgroups gmane.comp.db.postgresql.novice
Message-ID <CAAY=A78gDhsiY4TkedccBxqQ2StY9ee9khqqt2x2zuc+=vA+sg@mail.gmail.com>
I need to get the sequence value of  a table before inserting a new record,
so I am using *currval, *but I am getting an error stating that "currval is
not defined for this session". I tried using *nextval*, but the sequence
skips one value because *nextval* increments by one and also an additional
increment is preformed by the *insert* operation.

How can I get the next available value avoiding these issues?

Regards,
Jorge Maldonado
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.