Migrating sequences to Postgres

When moving a database from mysql to postgres, it’s often necessary to reset the sequences (.i.e. autoupdated row ids)

Find out what the largest one is with select max (id) from mytable;

Set the sequence with select setval('mytable_id_seq',x+1) ;