Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Until the sequence rolls over. Why design a schema with built in failure (an integer PK that overflows)?


Sequences 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)


The 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: