SELECT MAX(id) FROM your_table;
// Then run...
// This should be higher than the last result.
SELECT nextval('your_table_id_seq');
// If it's not higher... run this to try and fix it. (run a quick pg_dump first...)
SELECT setval('your_table_id_seq', (SELECT MAX(id) FROM your_table)+1);
当postgresql表中主键自增出现问题…
最新推荐文章于 2021-11-11 09:27:09 发布