我试图创建PostgreSQL数据库备份,但得到以下错误:pg_dump的:没有找到匹配的模式
我以root身份登录并运行命令
的pg_dump -f db.dump --format =平原--schema = existing_schema --username =用户X主机=本地主机数据库名称
\ DL的输出:
List of relations Schema | Name | Type | Owner --------+-------------------------------------+-------+------- public | existing_schema | table | userx
该模式的名字是public
。
existing_schema
是在架构公众表的名称。
这不是从你想做什么你pg_dump的命令行明确。
如果你要导出从架构public
你需要指定的所有表:
--schema=public
如果您只想导出表existing_schema
那么你需要指定:
--table=existing_schema
你可以用反斜杠和双引号提到qazxsw POI尝试。
here
对于未来的Google,在我的情况我的架构有圆点(“my.schema”),并通过逃避来解决这个问题的正确方法是:
sudo -u postgres pg_dump -v Database_Name -t "\"Table_Name\""
pg_dump -U postgres -d mydatabase --schema \"my.schema\"
如果你想只转储模式,
\dn list out all the schema in the database