Обсуждение: INT8 sequences
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
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