i moved postgresql database to another server and migrated datas to new postgresql server.

it started from 1 but there were 1470 datas in messages table.

you just need to change postgresql nextval with SETVAL

open your database properties (i used dbeaver for it)

find message_id column default value like

nextval('messages.messages_message_id_seq'::regclass)

open the sql editor and execute the code

firstly, just check your nextval with

SELECT nextval('messages.messages_message_id_seq');

now set your wish, i wish it is better 1470 for my situation.

select setval ('messages.messages_message_id_seq', 1473)

to check your nextval

SELECT nextval('messages.messages_message_id_seq');

c u

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

No responses yet

Write a response