PostgreSQLの自動採番をなおす
Page content
シーケンスオブジェクトの値の更新
SELECT MAX(id) FROM table;
SELECT nextval('table_id_seq');
SELECT setval('table_id_seq', (SELECT MAX(id) FROM table));
SELECT MAX(id) FROM table;
SELECT nextval('table_id_seq');
SELECT setval('table_id_seq', (SELECT MAX(id) FROM table));