2

I want to skip some ranges in sequence:

Create sequence id_seq;

Consider I have a sequence as Id_seq.. And it starts from 100..

When it reaches to 199.. Then it should start with 1000 and when it reaches 1999 .. It should start with 10000..

setval(100,'Id_seq');

Whether postgres has any default configuration to do this?

Multiple process will use this sequence.. So assigning manually in process using setval() lead some difficulties..

1 Answer 1

2

No there is nothing built in to do this. I've never heard of anyone wanting to do this before.

If you really care about the numbers you get then a sequence isn't the right thing for you anyway. You can get gaps in it quite easily. It's designed to generate differing numbers without impacting concurrency.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.