pg_dump ignoring table sequence?

后端 未结 1 689
星月不相逢
星月不相逢 2021-02-07 09:15

I have been playing around with PostgreSQL lately, and am having trouble understanding how to backup and restore a single table.

I used pgadmin3 to backup a single table

相关标签:
1条回答
  • 2021-02-07 09:42

    dumping by table only - will dump only the table. You need to dump the sequence separately in addition to the table.

    If you dont know your sequence you can list it with \d yourtable in psql. You will see something in the row your sequence is on that looks like : nextval('yourtable_id_seq'::regclass')

    Then from the command line, pgdump -t yourtable_id_seq

    http://www.postgresql.org/docs/9.0/static/app-pgdump.html

    0 讨论(0)
提交回复
热议问题