postgresql - Restarting Primary Key -


here situation:

i have table gets truncated once week , new values placed in it.

what want do:

i want add primary key starts @ 1 , increases 1 each row in table gets inserted. when table gets truncated, want count start @ 1.

is possible?

use serial column , use option restart identity

truncate table foo restart identity 

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


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -