Getting Sequence Value - Mailing list pgsql-novice

From JORGE MALDONADO
Subject Getting Sequence Value
Date
Msg-id CAAY=A78gDhsiY4TkedccBxqQ2StY9ee9khqqt2x2zuc+=vA+sg@mail.gmail.com
Whole thread Raw
Responses Re: Getting Sequence Value
List pgsql-novice
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 

pgsql-novice by date:

Previous
From: Tomasz Barszczewski
Date:
Subject: Re: PostgreSQL database for GITLAB - Must it use the public schema?
Next
From: "David G. Johnston"
Date:
Subject: Re: Getting Sequence Value