把当前最大的 id 做为当前的 id 自增起始数
使用语句: select setval('your_table_id_seq',(select max(id) from 表名));
如何查看 your_table_id_seq?
使用命令:\d 表名
使用语句: select setval('your_table_id_seq',(select max(id) from 表名));
使用命令:\d 表名
postgresql 修改id的自增起始数
https://www.explorexd.com/archives/ab7d7d4c-e284-4d5e-8cd0-b63b74fbff60
评论