Re: Serial Foreign Key

Поиск
Список
Период
Сортировка
От Michael Glaesemann
Тема Re: Serial Foreign Key
Дата
Msg-id A58F4DE8-6076-11D9-B225-000A95C88220@myrealbox.com
обсуждение исходный текст
Ответ на Serial Foreign Key  (Jonathan Stafford <thecabinet@gmail.com>)
Список pgsql-general
On Jan 7, 2005, at 14:45, Jonathan Stafford wrote:

> Suppose I have two tables:
>
> create table t1 (
>    id    serial    not null
> );
>
> create table t2 (
>    id    serial    not null,
>    t1    integer    not null,
>    foreign key (t1) references t1 (id)
> );
>
> Should the "t1 integer" actually be a bigint?  I ask because when I do
> "select * from t1_id_serial" the max_value is much larger than 2^32.
> Does this vary from system to system?

While all sequences are 64 bit integers, SERIAL is essentially INTEGER
DEFAULT nextval('foo_seq') (and creating the necessary sequence), so it
will only include 32 bit integers. If you want 64 bit integers, you can
use BIGSERIAL.

Best,

Michael Glaesemann
grzm myrealbox com


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

Предыдущее
От: Bruno Wolff III
Дата:
Сообщение: Re: warning: pg_query(): Query failed
Следующее
От: "Craig Bryden"
Дата:
Сообщение: Books for experienced DB developer