Fixing holes/gaps in numbers generated by Postgres sequence

前端 未结 3 1343
误落风尘
误落风尘 2020-12-21 12:35

I have a postgres database that uses sequences extensively to generate primary keys of tables. After a lot of usage of this database i.e. Adding/Update/Delete operation the

3条回答
  •  囚心锁ツ
    2020-12-21 13:30

    If you feel the need to fill gaps in auto-generated Posgresql sequence numbers, I have the feeling you need another field in your table, like some kind of "number" you increment programmatically, either in your code, or in a trigger.

提交回复
热议问题