3 ms·
Sequences are guaranteed to produce unique values. Just manually configure each child table to use the same sequence for the primary key column. Yes, uniqueness
by pilif 13y ago
Sequences are guaranteed to produce unique values. Just manually configure each child table to use the same sequence for the primary key column. Yes, uniqueness won't be enforced on the parent table, but the values will still be unique (unless you manually update them in your queries)
- trippy_biscuits 13y agoUntil the sequence rolls over. Why design a schema with built in failure (an integer PK that overflows)?
- pilif 13y agoSequences won't roll over by default. nextval() fails if you're out of values. You can create a sequence which is allowed to roll over (by specifying cycle), but it's not the default. Yes. It's not optimal and you can shoot yourself in the foot, but it works in its default configuration. I just gave a workable workaround for a problem, I wasn't saying it's the perfect solution (a working unique constraint on the parent table would be)
- Negitivefrags 13y agoThe default sequence size is 64 bit. Even if you are getting 100,000 ids a second from it you wont run out for over 5 million years.