Re: BUG #16018: pg_sequence_last_value() doesn't give results for owners

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #16018: pg_sequence_last_value() doesn't give results for owners
Дата
Msg-id 9246.1569282009@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: BUG #16018: pg_sequence_last_value() doesn't give results for owners  (Robert Treat <rob@xzilla.net>)
Список pgsql-bugs
Robert Treat <rob@xzilla.net> writes:
> On Mon, Sep 23, 2019 at 6:34 PM David G. Johnston
> <david.g.johnston@gmail.com> wrote:
>> From pg_sequences:
>> last_value bigint The last sequence value written to disk. If caching is used, this value can be greater than the
lastvalue handed out from the sequence. Null if the sequence has not been read from yet. Also, if the current user does
nothave USAGE or SELECT privilege on the sequence, the value is null. 

> Ugh... the situation is further complicated in that setval seems to
> cause a read, but alter sequence restart does not. Fun.

setval can set is_called to either true or false.  In the false
state, you get a null here.

>> The "last_value" on the sequence object has a different definition than the one on the relatively new pg_sequences
catalog.

> Any chance you have a pointer to documentation on the differences?

David quoted the docs about pg_sequences.last_value.
pg_sequence_last_value() isn't documented separately because you're
not really supposed to call it directly, only through the view.

currval()/lastval() give the last sequence value actually returned in
the current session, independently of what other sessions did since.

            regards, tom lane



В списке pgsql-bugs по дате отправления:

Предыдущее
От: Robert Treat
Дата:
Сообщение: Re: BUG #16018: pg_sequence_last_value() doesn't give results for owners
Следующее
От: Ashesh Vashi
Дата:
Сообщение: Re: Query tool won't load