Re: sequence current value

From: Dave Page <dpage(at)pgadmin(dot)org>
To: Michael Shapiro <mshapiro51(at)gmail(dot)com>
Cc: PgAdmin Support <pgadmin-support(at)postgresql(dot)org>
Subject: Re: sequence current value
Date: 2021-05-17 08:41:03
Message-ID: CA+OCxowo-drY=WBg5E0PFKMK-wpHPYeL6=rX192MvtD0NMv7+Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support

On Fri, May 14, 2021 at 5:32 PM Michael Shapiro <mshapiro51(at)gmail(dot)com>
wrote:

> I tried this. I created a sequence, and ran last_value, then nextval,
> repeatedly. last_value always returned 20 until nextval returned 21, then
> last_value returned 40 and kept returning 40 until nextval returned 41, etc.
>

Weird things can happen with sequences (well, they look weird sometimes -
actually they're the behaviour people want in real world applications), due
to caching and different sessions. What does "select * from <sequence>"
show? And how were you running those queries, both in terms of pgAdmin vs.
psql etc. and transaction control?

>
>
> On Fri, May 14, 2021 at 9:39 AM Dave Page <dpage(at)pgadmin(dot)org> wrote:
>
>>
>>
>> On Fri, May 14, 2021 at 3:33 PM Michael Shapiro <mshapiro51(at)gmail(dot)com>
>> wrote:
>>
>>> How does PgAdmin get the current value of a sequence when showing the
>>> sequence properties?
>>>
>>
>> SELECT last_value FROM <sequence_name>;
>>
>> (essentially. It gets a few other things as well)
>>
>> --
>> Dave Page
>> Blog: https://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EDB: https://www.enterprisedb.com
>>
>>

--
Dave Page
Blog: https://pgsnake.blogspot.com
Twitter: @pgsnake

EDB: https://www.enterprisedb.com

In response to

Browse pgadmin-support by date

  From Date Subject
Next Message Durai Raj 2021-05-17 11:47:14 Fatal Error
Previous Message Fahar Abbas 2021-05-17 05:53:20 Re: pgAdmin4 fatal error