Re: Help with pre-loaded arbitrary key sequences

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: Help with pre-loaded arbitrary key sequences
Дата
Msg-id 20080116134236.GA27832@svana.org
обсуждение исходный текст
Ответ на Help with pre-loaded arbitrary key sequences  ("James B. Byrne" <byrnejb@harte-lyne.ca>)
Список pgsql-general
On Fri, Jan 11, 2008 at 11:43:54AM -0500, James B. Byrne wrote:
> My question is this: Can one assign an id number to a sequenced key column
> on create and override the sequencer?  If one does this then can and, if
> so, how does the sequencer in Postgresql handle the eventuality of running
> into a block of keys holding previously assigned numbers?

You can set the counter during create, or at any time later. However,
the counter is not defined by the column as such and will happily
return numbers already in the table if you screw it up.

The usual process is to insert normally when loading the data and then
do a setval() on the sequence to past the values already stored.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Those who make peaceful revolution impossible will make violent revolution inevitable.
>  -- John F Kennedy

Вложения

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

Предыдущее
От: "R.A."
Дата:
Сообщение: Re: Can I create a TYPE (or DOMAIN) with arguments?
Следующее
От: Csaba Nagy
Дата:
Сообщение: Re: varchar sort ordering ignore blanks