2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【備忘録】PostgreSQLでautoincrementのidを再設定する。

Posted at

PostgreSQLでauto_incrementの再設定方法です。idを途中から設定する方法を記載します。

再設定方法
SELECT SETVAL ('テーブル名_カラム名_seq', idの開始No, false);
具体例(usersテーブルのidカラムを100に設定する。)
SELECT SETVAL ('users_id_seq', 100, false);
2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?