pg_dump:找不到匹配的模式

Nat*_*ley 6 postgresql pg-dump postgresql-9.4 case-sensitive

我正在尝试从 Postgres 9.4 转储模式,在 Cents 6.5 上运行,但出现错误:

pg_dump:找不到匹配的模式

这是我正在运行的命令:

pg_dump -U postgres -n "OLD-TODELETE-bushes" --verbose site > output_nf
Run Code Online (Sandbox Code Playgroud)

我对此有点困惑,因为当我运行时select schema_name from information_schema.schemata,我可以看到架构名称。

如果我为所有模式运行 pg_dump,则按OLD-TODELETE-bushes预期将其转储到文件中。

Postgres 日志中没有错误。

谁有想法?

Nat*_*ley 7

通过将引号更改为"schema_name"来解决此问题'"schema_name"'

请参阅:pg_dump 不会转储带有大写字母的数据方案

...汤姆·莱恩 (Tom Lane) 的回答是

问题是需要两个级别的引用:一个用于 shell,另一个用于 SQL。正如你写的那样,shell 去掉了双引号,所以 pg_dump 得到了 Schema,它按照普通的 SQL 规则进行了大小写折叠。所以你需要写:

pg_dump -n '"Schema"' -U postgres database
Run Code Online (Sandbox Code Playgroud)

现在,shell 处理单引号并将“Schema”传递给 pg_dump。