Re: Best way to create unique primary keys across schemas?

Поиск
Список
Период
Сортировка
От panam
Тема Re: Best way to create unique primary keys across schemas?
Дата
Msg-id 1327445696484-5428997.post@n5.nabble.com
обсуждение исходный текст
Ответ на Re: Best way to create unique primary keys across schemas?  (Chris Angelico <rosuav@gmail.com>)
Ответы Re: Best way to create unique primary keys across schemas?  (Chris Angelico <rosuav@gmail.com>)
Список pgsql-general
Chris Angelico wrote
>
> I would recommend using an explicit sequence object rather than
> relying on odd behavior like this; for instance, if you now drop
> public.tbl, the sequence will be dropped too. However, what you have
> there is going to be pretty close to the same result anyway.
>
Oops, thanks for the warning. Any means to prevent accidently dropping the
sequence by deleting the corresponding "root"-table?
What do you mean with "explicit sequence object"? An own sequence for each
table per schema?


Chris Angelico wrote
>
> I think it's possible
> to reset a sequence object to start producing lower numbers again,
> while your table still has some higher numbers in it (of course being
> careful not to get pkey collisions).
>
Yes, this is definitely possible
(http://www.postgresql.org/docs/9.1/static/sql-altersequence.html)


--
View this message in context:
http://postgresql.1045698.n5.nabble.com/Best-way-to-create-unique-primary-keys-across-schemas-tp5165043p5428997.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

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

Предыдущее
От: jonesd@xmission.com
Дата:
Сообщение: Document routing workflow database design
Следующее
От: Merlin Moncure
Дата:
Сообщение: Re: Best way to create unique primary keys across schemas?