L
L
leremin2017-02-15 07:23:52
PostgreSQL
leremin, 2017-02-15 07:23:52

Is it possible to "defragment" primary keys in PostgreSQL?

In the process of working with the database, it has a bunch of gaps in the primary keys, for example:
INSERT, INSERT, DELETE, INSERT will give 1,2,4.
Is there any universal remedy to remove these gaps in the entire database (to become 1,2,3) and update the referencing rows of other tables?
PS: the question is solely for the sake of perfectionism. the fact that there is no sense in this - I understand.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Axian Ltd., 2017-02-15
@AxianLTD

Unload, clear and load the database from the dump. Yes, and this is if the keys are not semantic (you can assign a surname as a primary key, for example, assign, then how?)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question