Re: COPY data into a table with a SERIAL column?

Поиск
Список
Период
Сортировка
От David G Johnston
Тема Re: COPY data into a table with a SERIAL column?
Дата
Msg-id CAKFQuwbHfqmUftOoq9-1=NPRsvw=dx3DRH8S=pduRCtwuy3ktQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: COPY data into a table with a SERIAL column?  (Rob Sargent <robjsargent@gmail.com>)
Ответы Re: COPY data into a table with a SERIAL column?  (Rob Sargent <robjsargent@gmail.com>)
Список pgsql-general
On Thu, Oct 16, 2014 at 11:44 AM, lup [via PostgreSQL] <[hidden email]> wrote:


I appreciate the vastness of bigserial but I think it starts at 1.  Are negative numbers even allowed?


A DEFAULT sequence starts at one but it is able to generate any biginteger value.​  Regardless, the value generated by the sequence and the allowed values for the target column are distinct - which is why a sequence attached to a normal integer will start throwing "value out of bounds" errors before it runs out of values.

Therefore, by default if one is able to live with disallowing half of the bigint range for auto-generation using the negative half of the range for manual assignment is a quick-and-simple solution to the problem.

David J.



View this message in context: Re: COPY data into a table with a SERIAL column?
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

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

Предыдущее
От: Andreas Kretschmer
Дата:
Сообщение: Re: How to Install Extensions
Следующее
От: Rob Sargent
Дата:
Сообщение: Re: COPY data into a table with a SERIAL column?