53.23. pg_sequences #

Представление pg_sequences даёт доступ к полезной информации обо всех последовательностях в базе данных.

Таблица 53.23. Столбцы pg_sequences

Тип столбца

Описание

schemaname name (ссылается на pg_namespace.nspname)

Имя схемы, содержащей последовательность

sequencename name (ссылается на pg_class.relname)

Имя последовательности

sequenceowner name (ссылается на pg_authid.rolname)

Имя владельца последовательности

data_type regtype (ссылается на pg_type.oid)

Тип данных последовательности

start_value int8

Начальное значение последовательности

min_value int8

Минимальное значение последовательности

max_value int8

Максимальное значение последовательности

increment_by int8

Шаг увеличения последовательности

cycle bool

Зацикливается ли последовательность

cache_size int8

Размер кеша последовательности

last_value int8

Последнее значение последовательности, записанное на диск. Если используется кеширование, это значение может быть больше последнего значения, полученного из последовательности.


Столбец last_value будет считаться равным NULL, если выполняется любое из следующих условий:

  • Чтение из последовательности ещё не выполнялось.

  • Текущий пользователь не имеет права USAGE или SELECT для этой последовательности.

  • Последовательность — нежурналируемая, а сервер — резервный.

53.23. pg_sequences #

The view pg_sequences provides access to useful information about each sequence in the database.

Table 53.23. pg_sequences Columns

Column Type

Description

schemaname name (references pg_namespace.nspname)

Name of schema containing sequence

sequencename name (references pg_class.relname)

Name of sequence

sequenceowner name (references pg_authid.rolname)

Name of sequence's owner

data_type regtype (references pg_type.oid)

Data type of the sequence

start_value int8

Start value of the sequence

min_value int8

Minimum value of the sequence

max_value int8

Maximum value of the sequence

increment_by int8

Increment value of the sequence

cycle bool

Whether the sequence cycles

cache_size int8

Cache size of the sequence

last_value int8

The last sequence value written to disk. If caching is used, this value can be greater than the last value handed out from the sequence.


The last_value column will read as null if any of the following are true:

  • The sequence has not been read from yet.

  • The current user does not have USAGE or SELECT privilege on the sequence.

  • The sequence is unlogged and the server is a standby.