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

php - Passing multiple values in a url using checkbox -

compilation - PHP install fails on Ubuntu 14 (make: *** [sapi/cli/php] Error 1) PHP 5.6.20 -

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