0

I use pg_dump to backup and restore to target and manually sync (using setval function) sequences on tables. Is following an option to avoid manual sync or manual sync is always required?

pg_dump -s (schema-only) + pg_dump -a (only data from tables/LOB/Sequence Values) 

And then i use pg_restore in same order which sync the sequences automatically

Falcon
  • 47
  • 6

1 Answers1

1

To get a script that sets the value of a sequence seq, you can run a data-only pg_dump for this sequence:

pg_dump -a -t seq
Laurenz Albe
  • 209,280
  • 17
  • 206
  • 263