Reputation: 744
I am using a command to change the number the auto increment sequence starts at for the id field:
ALTER SEQUENCE orders_order_id_seq RESTART 14028;
I would like to make this increment by 4 instead of by 1. Is this possible?
I know this is a very short question but I don't have code examples I can provide for this. I have not found anything in the documentation or other questions that address this query.
Upvotes: 2
Views: 247
Reputation: 3866
Yes, it is possible. Try
alter sequence orders_order_id_seq INCREMENT 4
PostgreSQL Documentation. ALTER SEQUENCE
increment The clause INCREMENT BY increment is optional. A positive value will make an ascending sequence, a negative one a descending sequence. If unspecified, the old increment value will be maintained.
Upvotes: 2