Change the starting value of a serial - Postgresql

前端 未结 4 1842
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-03 22:28

I\'ve a little problem with serial : From a file, I filled my database in which I have a client ID (it is a serial and it is my primary key). I have 300 clients so 300 client ID

4条回答
  •  伪装坚强ぢ
    2021-02-03 23:02

    PostgreSQL

    ALTER SEQUENCE tablename_columnname_seq RESTART WITH anynumber;
    

    Example:

    ALTER SEQUENCE test_table_rec_id_seq RESTART WITH 4615793;
    

提交回复
热议问题