Heroku pg:拉不能填充模式 [英] Heroku pg:pull failing to populate schema

查看:142
本文介绍了Heroku pg:拉不能填充模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我已阅读<$ c上的文档 $ c> pg:pull ,但似乎无法让它工作。当我使用正确的参数运行该命令时,我的Heroku DB被提取并创建了一个本地数据库,但该模式未在本地填充;例如,没有创建表,没有设置触发器,没有约束,没有数据等。



这里是 heroku pg:info

code> log for my database:

  === HEROKU_POSTGRESQL_ORANGE_URL(DATABASE_URL)
计划:Hobby-dev
状态:可用
连接数:1
PG版本:9.3.3
创建时间:2014-04-02 19:24 UTC
数据大小:7.4 MB
表格:6
行数:1376/10000(合规)
分叉/关注:不支持的
回滚:不支持的

以下是我正在使用的命令:

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



我无法弄清楚如何为 PGUSER PGPASSWORD (如果任何人都可以在正确的方向指向我,你会得到+1,我读此问题并回答无效)。

mylocaldb

下面是 pg_dump 命令一次运行:

  pg_dump:读取模式
pg_dump:读取用户定义的表
pg_dump:读取扩展名
pg_dump:读取用户定义函数
pg_dump:读取用户定义类型
pg_dump:读取过程语言
pg_dump:读取用户定义的集合函数
pg_dump:读取用户 - 定义的操作符
pg_dump:读取用户定义的操作符类
pg_dump:读取用户定义的操作符族
pg_dump:读取用户定义的文本搜索解析器
pg_dump:读取用户定义的文本搜索模板
pg_dump:读取用户定义的文本搜索字典
pg_dump:读取用户定义的文本搜索配置
pg_dump:读取用户定义的外部数据包装s
pg_dump:读取用户定义的外部服务器
pg_dump:读取默认权限
pg_dump:读取用户定义的归类
pg_dump:读取用户定义的转换
pg_dump:读取类型转换
pg_dump:读取表继承信息
pg_dump:读取事件触发器
pg_dump:查找扩展成员
pg_dump:查找继承关系
pg_dump:读取列信息有趣的表
pg_dump:查找表短语的列和类型
pg_dump:查找表短语的默认表达式
pg_dump:查找表用户的列和类型
pg_dump:查找表users的默认表达式
pg_dump:查找表favorite_phrases的列和类型
pg_dump:查找表favorite_users的列和类型
pg_dump:查找表phrasebooks的列和类型
pg_dump:查找表phrasebooks的默认表达式
pg_dump:查找公司表和类型表phrasebooks_phrases
pg_dump:标记子表中的继承列
pg_dump:读取索引
pg_dump:读取表短语的索引
pg_dump:读取表的索引users
pg_dump:读取表favorite_phrases的索引
pg_dump:读取表favorite_users的索引
pg_dump:读取表phrasebooks的索引
pg_dump:读取索引表phrasebooks_phrases
pg_dump:读取约束
pg_dump:读取表短语的外键约束
pg_dump:读取表用户的外键约束
pg_dump:读取表foreign_phrases的外键约束
pg_dump:读表foreign_users的外键约束
pg_dump:读表的表phrasebooks的外键约束
pg_dump:读触发器
pg_dump:读取表格短语的触发器
pg_dump:读取表格用户的触发器
pg_dump:读取触发器gers for tablefavorite_phrases
pg_dump:读取表格favorite_users的触发器
pg_dump:读取表格phrasebooks的触发器
pg_dump:读取重写规则
pg_dump:读取大对象
pg_dump:读取依赖关系数据
pg_dump:保存encoding = UTF8
pg_dump:保存standard_conforming_strings = on
pg_dump:保存数据库定义
pg_restore:[archiver]找不到文件头中的魔术字符串
pg_dump:[custom archiver]警告:ftell与预期位置不匹配 - fte
ll使用
pg_dump:[custom archiver]警告:ftell与预期位置不匹配 - fte
ll使用
pg_dump:转储表的内容favorite_phrases
pg_dump:[custom archiver]警告:ftell与预期位置不匹配 - fte
ll使用
pg_dump:转储表的内容favorite_users
pg_dump:[custom archiver]警告:ftell与预期位置不匹配 - fte
ll将使用
pg_dump:转储内容table phrasebooks
pg_dump:[custom archiver]警告:ftell与预期位置不匹配 - fte
ll使用
pg_dump:转储表的内容phrasebooks_phrases
pg_dump:[custom archiver]警告:ftell与预期位置不匹配 - fte
ll使用
pg_dump:转储表短语的内容
pg_dump:[自定义归档程序]无法写入输出文件:无效参数

是否有某种进一步的配置需要本地执行才能工作?如果它很重要,我正在使用一个自定义的停用词字典( tsquery ),该词典在本机上尚未在本地设置(但是)...我怀疑这将是一个问题出现在 pg_dump 中,不过...非常感谢任何帮助!



编辑 :我试着在我的桌面上运行这个命令,这个命令是配置了所有东西的其他本地站。没有骨头。我得到完全相同的结果。下面是在本地机器上的其中psql 的输出,以防万一:

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


pg:pull pg:push 命令。



pg:pull pg:push pg_dump 命令和管道直接连接到 pg_restore 源代码)。不幸的是,在截至2014年9月这个答案的时候,窗口上的 pg:push,pull 存在问题。这些问题并非不可解决,所以如果您要这样做
$ b

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



我采取了刺杀一次,通过使用popen独立设置命令,然后将它们连接在一起而不是使用管道。但是,我无法完全实现它,并且不得不停止。



我很乐意查看任何可以解决此问题的补丁程序,只是@提及我对heroku / heroku项目的拉取请求。



对不起,我无法解决此问题:(b / b)

取而代之的是,在解决此问题之前,可以分别使用 pg_dump pg_restore 命令,直接进行,这是一个2步骤的过程,并且不得不查找远程凭证,但它会使工作完成。 gen_pg _ * _ command 方法中的链接源显示如何使用 pg_dump pg_restore


So I've read the documentation on pg:pull, but can't seem to get it to work. When I run the command with the correct parameters, my Heroku DB is fetched and a local database is created, but the schema is not filled in locally; e.g., no tables are created, no triggers are set up, no constraints, no data, etc.

Here's the heroku pg:info log for my database:

=== 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

Here is the command that I'm using:

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

I couldn't figure out how to set the environment variables for PGUSER and PGPASSWORD (if anyone can point me in the right direction there, you'll get a +1. I read this question and answer to no avail).

mylocaldb is created, but the schema is not filled in.

Here is the pg_dump once the command was run:

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

Is there some kind of further configuration that I need to do locally for this to work? If it matters, I am using a custom stop-word dictionary for tsquery which isn't set up locally (yet) on this machine... I doubt that would be a problem in the pg_dump though... Any help is much appreciated!

Edit: I just tried running this command on my desktop, the other local station that has everything configured. No bones. I'm getting the exact same results. Below is the output of which psql on said local machine, just in case:

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

解决方案

I wrote the pg:pull and pg:push commands.

pg:pull and pg:push both use the pg_dump command and pipe that directly to pg_restore (source code). Unfortunately, there are problems with pg:push,pull on windows as of the time of this answer, September 2014. These problems are not insurmountable, so if you are coming to this answer sometime later, please check to see if it might have been fixed.

The env command used here and here I don't think is on windows, which is why you're having to do the PGUSER and PGPASSWORD stuff. However the reason for the env is that pg_dump needs different environment variables than pg_restore.

I took a stab at fixing that once, by using popen to set up the commands independently, then wire them together instead of using a pipe. However, I couldn't quite get it working, and had to stop.

I'd be very happy to review any patches that go all the way and fix this issue, just @ mention me on a pull request to the heroku/heroku project.

Sorry for my failing to fix this issue :(

Instead, and until this is fixed, you can use the pg_dump and pg_restore commands separately, directly. It's more cumbersome as a 2 step process, and having to look up the remote credentials, but it would get the job done. The linked source in the gen_pg_*_command methods show how to use pg_dump and pg_restore.

这篇关于Heroku pg:拉不能填充模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆