Heroku pg:拉不能填充模式

所以我已经阅读了关于pg:pull的文档 ,但似乎无法使其工作。 当我用正确的参数运行命令时,我的Heroku数据库被提取并创build了一个本地数据库,但是模式没有被本地填充; 例如,没有创build表,没有设置触发器,没有约束,没有数据等。

这里是我的数据库的heroku pg:info日志:

 === HEROKU_POSTGRESQL_ORANGE_URL (DATABASE_URL) Plan: Hobby-dev Status: Available Connections: 1 PG Version: 9.3.3 Created: 2014-04-02 19:24 UTC Data Size: 7.4 MB Tables: 6 Rows: 1376/10000 (In compliance) Fork/Follow: Unsupported Rollback: Unsupported 

这是我正在使用的命令:

PGUSER=postgres PGPASSWORD=password heroku pg:pull HEROKU_POSTGRESQL_ORANGE mylocaldb --app myappname

我不知道如何设置PGUSERPGPASSWORD的环境variables(如果有人能指出我在正确的方向,你会得到一个+1,我读这个问题和答案无济于事)。

mylocaldb被创build,但是模式没有被填充。

一旦命令运行,这是pg_dump

 pg_dump: reading schemas pg_dump: reading user-defined tables pg_dump: reading extensions pg_dump: reading user-defined functions pg_dump: reading user-defined types pg_dump: reading procedural languages pg_dump: reading user-defined aggregate functions pg_dump: reading user-defined operators pg_dump: reading user-defined operator classes pg_dump: reading user-defined operator families pg_dump: reading user-defined text search parsers pg_dump: reading user-defined text search templates pg_dump: reading user-defined text search dictionaries pg_dump: reading user-defined text search configurations pg_dump: reading user-defined foreign-data wrappers pg_dump: reading user-defined foreign servers pg_dump: reading default privileges pg_dump: reading user-defined collations pg_dump: reading user-defined conversions pg_dump: reading type casts pg_dump: reading table inheritance information pg_dump: reading event triggers pg_dump: finding extension members pg_dump: finding inheritance relationships pg_dump: reading column info for interesting tables pg_dump: finding the columns and types of table "phrases" pg_dump: finding default expressions of table "phrases" pg_dump: finding the columns and types of table "users" pg_dump: finding default expressions of table "users" pg_dump: finding the columns and types of table "favorite_phrases" pg_dump: finding the columns and types of table "favorite_users" pg_dump: finding the columns and types of table "phrasebooks" pg_dump: finding default expressions of table "phrasebooks" pg_dump: finding the columns and types of table "phrasebooks_phrases" pg_dump: flagging inherited columns in subtables pg_dump: reading indexes pg_dump: reading indexes for table "phrases" pg_dump: reading indexes for table "users" pg_dump: reading indexes for table "favorite_phrases" pg_dump: reading indexes for table "favorite_users" pg_dump: reading indexes for table "phrasebooks" pg_dump: reading indexes for table "phrasebooks_phrases" pg_dump: reading constraints pg_dump: reading foreign key constraints for table "phrases" pg_dump: reading foreign key constraints for table "users" pg_dump: reading foreign key constraints for table "favorite_phrases" pg_dump: reading foreign key constraints for table "favorite_users" pg_dump: reading foreign key constraints for table "phrasebooks" pg_dump: reading triggers pg_dump: reading triggers for table "phrases" pg_dump: reading triggers for table "users" pg_dump: reading triggers for table "favorite_phrases" pg_dump: reading triggers for table "favorite_users" pg_dump: reading triggers for table "phrasebooks" pg_dump: reading rewrite rules pg_dump: reading large objects pg_dump: reading dependency data pg_dump: saving encoding = UTF8 pg_dump: saving standard_conforming_strings = on pg_dump: saving database definition pg_restore: [archiver] did not find magic string in file header pg_dump: [custom archiver] WARNING: ftell mismatch with expected position -- fte ll used pg_dump: [custom archiver] WARNING: ftell mismatch with expected position -- fte ll used pg_dump: dumping contents of table favorite_phrases pg_dump: [custom archiver] WARNING: ftell mismatch with expected position -- fte ll used pg_dump: dumping contents of table favorite_users pg_dump: [custom archiver] WARNING: ftell mismatch with expected position -- fte ll used pg_dump: dumping contents of table phrasebooks pg_dump: [custom archiver] WARNING: ftell mismatch with expected position -- fte ll used pg_dump: dumping contents of table phrasebooks_phrases pg_dump: [custom archiver] WARNING: ftell mismatch with expected position -- fte ll used pg_dump: dumping contents of table phrases pg_dump: [custom archiver] could not write to output file: Invalid argument 

有什么进一步的configuration,我需要在本地做这个工作? 如果它很重要,我使用tsquery自定义停止词的字典,这是不是本地(但)在本机上设置…我怀疑这将是一个问题在pg_dump虽然…任何帮助,非常感谢!

编辑 :我只是尝试在我的桌面上运行此命令,其他本地站已configuration的一切。 没有骨头。 我得到完全相同的结果。 以下是本地机器上which psql的输出,以防万一:

 $ which psql /c/Program Files/PostgreSQL/9.3/bin/psql 

Solutions Collecting From Web of "Heroku pg:拉不能填充模式"

我写了pg:pullpg:push命令。

pg:pullpg:push都可以使用pg_dump命令和直接连接到pg_restore ( 源代码 )的管道。 不幸的是,在2014年9月的这个回答中, pg:push,pull窗口是有问题的。这些问题并不是无法克服的,所以如果你稍后再来回答这个问题,请检查一下是否可能固定。

这里和这里 使用的env命令我不认为是在Windows上,这就是为什么你必须做PGUSER和PGPASSWORD的东西。 然而, env的原因是pg_dump需要不同于pg_restore环境变量。

我试了一次,用popen独立设置命令,然后把它们连接在一起,而不是用管道。 但是,我无法完成它的工作,不得不停下来。

我会非常高兴地看到所有的补丁,并解决这个问题,只是@提到我对heroku / heroku项目的拉请求。

对不起,我未能解决这个问题:(

相反,在修复之前,可以直接使用pg_dumppg_restore命令。 作为一个两步骤的过程,更麻烦,不得不查找远程凭证,但它会完成工作。 gen_pg_*_command方法中的链接源显示了如何使用pg_dumppg_restore

如果是定期的Heroku开发,@ will的答案是完美的,但在私人空间的情况下失败。 正如Heroku Postgres和Heroku私人空间中所提到::外部连接 :

与我们的爱好,标准和高级层中的Heroku Postgres数据库不同,私人数据库不能通过本地计算机访问

作为一种解决方法,您可以将数据库复制到非私有数据库,然后您可以将数据库转储到本地组件。