我已经被玩弄的PostgreSQL最近,和我唔明如何备份和恢复单个表。

我用pgadmin3备份单个表在我的数据库,以便将其复制到另一台服务器。当我尝试做的文件pg_restore的,我得到错误信息说,该序列不存在:

pg_restore: [archiver (db)] could not execute query: ERROR:  relation "businesses_id_seq" does not exist
    Command was: 
CREATE TABLE businesses (
    id integer DEFAULT nextval('businesses_id_seq'::regclass) NOT NULL,
    name character varyin...

它看起来像转储文件没有包括我的自动递增列的顺序。我如何得到它包括?

有帮助吗?

解决方案

仅通过表倾倒 - 将转储只有表。您需要除了表分别转储序列。

如果你不知道你的程序,你可以在PSQL \d yourtable列出。您将看到您排顺序上,看起来像的东西:nextval('yourtable_id_seq'::regclass')

然后通过命令行,pgdump -t yourtable_id_seq

http://www.postgresql.org/docs/9.0/静态/ APP-pgdump.html

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top