我收到此错误消息:
pg_dump: too many command-line arguments (first is "demo_db") Try "pg_dump --help" for more information. rake aborted! Error dumping database Tasks: TOP => db:structure:dump (See full trace by running task with --trace)这用于在Rails 3.1下工作。 我使用的是Rails 3.2.3和PostgreSQL 9.0.5。 其他任务如db:migrate或db:rollback工作得很好。
I get this error message:
pg_dump: too many command-line arguments (first is "demo_db") Try "pg_dump --help" for more information. rake aborted! Error dumping database Tasks: TOP => db:structure:dump (See full trace by running task with --trace)This used to work under Rails 3.1. I'm using Rails 3.2.3 and PostgreSQL 9.0.5. Other tasks like db:migrate or db:rollback work just fine.
最满意答案
pg_dump命令在428行的activerecord / lib / active_record / railties / databases.rake中执行 。
`pg_dump -i -s -x -O -f #{Shellwords.escape(filename)} #{search_path} #{Shellwords.escape(config['database'])}`尝试在那里设置断点并查看正在运行的实际命令。
所有这些选项都适用于Pg9.0.x,所以我怀疑在abcs[Rails.env]['schema_search_path']中有一些有趣的东西混淆了psql的选项解析。 请注意, search_path构造不引用--schema参数,因此具有嵌入空间的search_path_part将作为部分模式名称进行解析,后跟一个没有选项的单词,因此psql会将其解释为数据库名称然后当它到达真正的数据库名称时发出抱怨。
Thanks to dbenhur I found the issue. I have a space in the path of my filename. Changing line 392 of activerecord/lib/active_record/railties/databases.rake to
pg_dump -i -s -x -O -f '#{filename}' #{search_path} #{abcs[Rails.env]['database']}(adding the single quotes around #{filename}) fixes the issue.
更多推荐
发布评论