Re: Problem with the sequence

From: Richard Huxton <dev(at)archonet(dot)com>
To: sid tow <siddy_tow(at)yahoo(dot)com>
Cc: psql mailing list <pgsql-general(at)postgresql(dot)org>
Subject: Re: Problem with the sequence
Date: 2005-02-03 09:22:55
Message-ID: 4201ED6F.3000206@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

sid tow wrote:
> HI
>
> I have a problem locating the documentation for "sequence". I want to get the detailed information about the columns present in a sequence table ie when I do
>
> psql=# select * from foo_seq;
> sequence_name | last_value | increment_by | max_value | min_value | cache_value | log_cnt | is_cycled | is_called
> ---------------------------+------------+--------------+---------------------+-----------+-------------+---------+-----------+-----------
> foo_seq | 11 | 1 | 9223372036854775807 | 1 | 1 | 0 | f | t
> (1 row)
>
> I need to know where do i find documentation to know what the columns specify and I have already checked the man pages of create_sequence where I did not find much.
> Can somebody give me ref to a link where I get such information.

From psql:
\d foo_seq
Sequence "public.foo_seq"
Column | Type
---------------+---------
sequence_name | name
last_value | bigint
increment_by | bigint
max_value | bigint
min_value | bigint
cache_value | bigint
log_cnt | bigint
is_cycled | boolean
is_called | boolean

From the manuals:
CREATE [ TEMPORARY | TEMP ] SEQUENCE name [ INCREMENT [ BY ] increment ]
[ MINVALUE minvalue | NO MINVALUE ] [ MAXVALUE maxvalue | NO MAXVALUE ]
[ START [ WITH ] start ] [ CACHE cache ] [ [ NO ] CYCLE ]

For the ones not mentioned in the manual:
last_value - is the last value given out by the sequence
is_called - says whether nextval() has been called in this session
(and so whether it is safe to call currval())
log_cnt - don't know, googling suggests it's to do with WAL logging.

Does that help?
--
Richard Huxton
Archonet Ltd

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2005-02-03 09:25:54 Re: change table to view problem
Previous Message Jonel Rienton 2005-02-03 08:36:00 Re: SQL query question