Обсуждение: INT8 sequences

Поиск
Список
Период
Сортировка

INT8 sequences

От
Radius Administrator
Дата:
Is it true that PostgreSQL sequences are always INT4?  If so, how
would the following be modified to work as obviously intended?

CREATE SEQUENCE tbl_id INCREMENT 1 START 1;
CREATE TABLE tbl
(       id              INT8 DEFAULT NEXTVAL('tbl_id') PRIMARY KEY
);

Thanks.

Lyle Frost
Citadel Network
www.cnz.com
radius@cnz.com


Re: INT8 sequences

От
Richard Huxton
Дата:
Radius Administrator wrote:
> 
> Is it true that PostgreSQL sequences are always INT4?  If so, how

Yep

> would the following be modified to work as obviously intended?
> 
> CREATE SEQUENCE tbl_id INCREMENT 1 START 1;
> CREATE TABLE tbl
> (
>         id              INT8 DEFAULT NEXTVAL('tbl_id') PRIMARY KEY
> );

Check the mailing list archives for lengthy discussions on int8
sequences. Once you've found it's mostly people complaining without
volunteering to do anything go over to http://techdocs.postgresql.org/
and look at Roberto Mello's plpgsql cookbook and the int8 page in my
postgresql notes - I summarised anything useful I saw about it. The
first example I give is probably fine for just generating unique id's.

- Richard Huxton