Search code examples
postgresqlsequencerestartalter

ALTER postgreSQL sequence


I am quite very new to postgreSQL. I am have a sequence which starts from 1 by default. What I am looking for is that if I want to move my next value, which is now 87, to 2000. I am unable to do that. Can any one suggest me how to go about doing the change?


Solution

  • You can ALTER the sequence using the following code:

    ALTER SEQUENCE seq_name RESTART 2000.
    

    I request you to please go through the postgres SQL manuals.

    http://www.postgresql.org/docs/current/static/sql-altersequence.html