加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

windows – Heroku pg:拉不能填充模式

发布时间:2020-12-13 22:34:34 所属栏目:Windows 来源:网络整理
导读:所以我在pg:pull上看了 documentation,但似乎无法让它工作.当我使用正确的参数运行命令时,将获取我的Heroku数据库并创建本地数据库,但架构未在本地填充;例如,没有创建表,没有设置触发器,没有约束,没有数据等. 这是我的数据库的heroku pg:info日志: === HE
所以我在pg:pull上看了 documentation,但似乎无法让它工作.当我使用正确的参数运行命令时,将获取我的Heroku数据库并创建本地数据库,但架构未在本地填充;例如,没有创建表,没有设置触发器,没有约束,没有数据等.

这是我的数据库的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 =密码heroku pg:拉HEROKU_POSTGRESQL_ORANGE mylocaldb –app myappname

我无法弄清楚如何为PGUSER和PGPASSWORD设置环境变量(如果有人能指出我在正确的方向,你会得到1.我读了this question并且回答无济于事).

已创建mylocaldb,但未填充架构.

命令运行后,这是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

我需要在本地进行某种进一步的配置吗?如果它很重要,我正在使用tsquery的自定义停用词词典,这个字典在本机上尚未设置…我怀疑这将是pg_dump中的一个问题但是…任何帮助都非常感谢!

编辑:我刚尝试在我的桌面上运行此命令,另一台配置了所有内容的本地站.没有骨头.我得到了完全相同的结果.下面是所述本地机器上psql的输出,以防万一:

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

解决方法

我写了pg:pull和pg:push命令.

pg:pull和pg:push都使用pg_dump命令并直接管道到pg_restore(source code).不幸的是,在2014年9月这个问题的答案时,pg:push,pull on windows存在问题.这些问题并非不可克服,所以如果你以后再来这个答案,请检查它是否可能是固定.

env命令used here和here我不认为是在Windows上,这就是你必须做PGUSER和PGPASSWORD的原因.然而,env的原因是pg_dump需要不同于pg_restore的环境变量.

我花了一次a stab at fixing that,通过使用popen独立设置命令,然后将它们连接在一起而不是使用管道.但是,我无法让它工作,不得不停下来.

我很乐意审查任何一路上的补丁并解决这个问题,只是@在向heroku / heroku项目的拉取请求中提及我.

抱歉,我未能解决此问题:(

相反,在修复此问题之前,您可以直接单独使用pg_dump和pg_restore命令.它作为一个两步过程更加繁琐,并且必须查找远程凭据,但它可以完成工作. gen_pg _ * _命令方法中的链接源显示如何使用pg_dump和pg_restore.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读