0

Scenario :

  • We are migrating data from a postgres DB to new EDB database .
  • We have migrated the sequence and all table data also .
  • Both DB is installed on a remote unix server and on diffrent machines.
  • There are 300+ sequences .

Issue : As we have inserted all table data by running a bunch of insert command which was exported from Dbeaver . And those insert command does not contains nextval() function . So all sequences in DB is still initialized with initial value . How to update the nextval of all sequence of all schema with the last value in new DB(EDB) as it was in old DB(postgres) ?

2
  • If you use pg_dump and pg_restore then all sequences will be restored correctly. Otherwise see here: stackoverflow.com/questions/244243 – a_horse_with_no_name Jun 28 '20 at 14:22
  • is it possible that a sequence is used by multiple tables ? If its possible , then is it a good practice to use a sequence with multiple tables ? I want to understand the advantage and disadvantage of this . – user236778 Jun 30 '20 at 3:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.