Getting the current value of a sequence

From: JORGE MALDONADO <jorgemal1960(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Getting the current value of a sequence
Date: 2015-04-23 11:17:42
Message-ID: CAAY=A7-QbOXAOvRPQdpSndXe+aJ+d+h4+zsmP1q7L4P1JrF=rA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I have been trying to get the current value of a sequence without success.
I have read that "currval" does the job but I do not know how to use it.
This is what I have tried and I get an error saying that "currval of
sequence 'name_of_sequence' is not defined for the session.

SELECT currval('name_of_sequence')

I will very much appreciate your feedback.

Respectfully,
Jorge Maldonado

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message hubert depesz lubaczewski 2015-04-23 11:46:54 Re: Getting the current value of a sequence
Previous Message amul sul 2015-04-21 10:38:33 Re: How to disable auto-commit in postgresql-9.4