36

我正在尝试在 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-> 

但在上面,什么也没发生,我在这里错过了什么?

4

2 回答 2

45

您需要在查询末尾使用分号:

select * from users;
于 2013-02-05T20:31:23.067 回答
11

运行这个

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

样本

heroku pg:psql -c "\?" --app app-sample
于 2018-03-24T01:51:03.573 回答