1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

how to change default min sequence value for database

Discussion in 'PostgreSQL' started by ungalnanban, Nov 9, 2011.

  1. ungalnanban

    ungalnanban New Member

    Joined:
    Feb 19, 2010
    Messages:
    45
    Likes Received:
    2
    Trophy Points:
    0
    Location:
    Chennai
    I have this doubt, how to configure the default min value for sequence in postgresql? Is it possible?


    I want to change the default min value of sequence in Postgresql for all my table in a database. I don't like to use CREATE SEQUENCE and ALTER SEQUENCE because I don't want to do manual work. If I create new table with sequence. that automatically should take the min value is 1000 instead of 1, after configured this If i create a sequence it should take default min val is 1000 (configured value)
    Where I need to configure the min val and max value for sequence in Postgresql. Is there any variable in Postgresql.conf file

    Thanks in advance
     
  2. pein87

    pein87 New Member

    Joined:
    Aug 6, 2010
    Messages:
    173
    Likes Received:
    47
    Trophy Points:
    0
    Occupation:
    Web Dev
    Location:
    Limbo
    Code:
    ALTER TABLE table_name AUTO_INCREMENT = 1000;
    do this before any rows are inserted so perform this right after the CREATE TABLE clause.
     

Share This Page