PostgreSQLの自動採番をなおす

シーケンスオブジェクトの値の更新

SELECT MAX(id) FROM table;
SELECT nextval('table_id_seq');
SELECT setval('table_id_seq', (SELECT MAX(id) FROM table));
Published At
Tagged with