如何在Heroku中使用pg:psql?

37

我正在尝试在Heroku终端上检测我的数据库:

myapp@ubuntu:~/RubymineProjects/myapp$ heroku pg:info
The plugin heroku-sql-console has been deprecated. Would you like to remove it? (y/N) n
=== HEROKU_POSTGRESQL_JADE_URL (DATABASE_URL)
Plan:        Dev
Status:      available
Connections: 1
PG Version:  9.1.6
Created:     2012-10-10 19:59 UTC
Data Size:   9.1 MB
Tables:      32
Rows:        2802/10000 (In compliance)
Fork/Follow: Unsupported

所以,我尝试了:

myapp@ubuntu:~/RubymineProjects/myapp$ heroku pg:psql
The plugin heroku-sql-console has been deprecated. Would you like to remove it? (y/N) n
psql (9.1.7, server 9.1.6)
SSL connection (cipher: **-**-****-**, bits: 256)
Type "help" for help.

我需要列出所有用户记录:

dbfjinfaes61gb=> select * from users
dbfjinfaes61gb-> 

但是上面的代码并没有发生任何事情,我在这里漏掉了什么?


1
SQL查询语句需要在结尾处加上; - jasonleonhard
2个回答

46

您需要在查询的末尾加上分号:

select * from users;

谢谢!是的,分号丢失了...现在我可以看到结果和最后的“END”,我该如何继续输入下一个命令? - simo

13

运行这个

heroku pg:psql -c "command" --app "name-app"

示例

heroku pg:psql -c "\?" --app app-sample

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接