Re: Best way to create unique primary keys across schemas? - Mailing list pgsql-general

From panam
Subject Re: Best way to create unique primary keys across schemas?
Date
Msg-id 1327445696484-5428997.post@n5.nabble.com
Whole thread Raw
In response to Re: Best way to create unique primary keys across schemas?  (Chris Angelico <rosuav@gmail.com>)
Responses Re: Best way to create unique primary keys across schemas?
List 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 by date:

Previous
From: jonesd@xmission.com
Date:
Subject: Document routing workflow database design
Next
From: Merlin Moncure
Date:
Subject: Re: Best way to create unique primary keys across schemas?