Postgres重置自增长id列(reset sequence)

简单的两个方法,个人比较喜欢第一个


ALTER SEQUENCE seq RESTART WITH 1;

SELECT setval('sequence_name', 0);




参考自http://stackoverflow.com/questions/4678110/how-to-reset-sequence-in-postgres-and-fill-id-column-with-new-data
posted on 2015-02-20 13:43  BoneKing  阅读(4190)  评论(0编辑  收藏  举报