Go4Expert

Go4Expert (http://www.go4expert.com/)
-   PostgreSQL (http://www.go4expert.com/forums/postgresql-forum/)
-   -   how to change default min sequence value for database (http://www.go4expert.com/forums/change-default-min-sequence-value-t27120/)

ungalnanban 9Nov2011 12:01

how to change default min sequence value for database
 
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

pein87 28May2012 22:21

Re: how to change default min sequence value for database
 
Code: SQL

ALTER TABLE table_name AUTO_INCREMENT = 1000;

do this before any rows are inserted so perform this right after the CREATE TABLE clause.


All times are GMT +5.5. The time now is 11:47.