How to use pg:psql in heroku?
Asked Answered
S

2

37

I am trying to detect my db at heroku terminal like this:

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

So, I tried:

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.

I need to list all users records:

dbfjinfaes61gb=> select * from users
dbfjinfaes61gb-> 

But above, nothing happened, what I am missing here?

Sherry answered 5/2, 2013 at 20:29 Comment(1)
SQL requires the ; at the end of the queryWadi
A
46

You need a semicolon at the end of the query:

select * from users;
Ancalin answered 5/2, 2013 at 20:31 Comment(1)
Thanks! yes its the semicolon was missing .. now I can see the result and 'END' at the end of it, how can I proceed to enter the next command?Sherry
C
13

Run this

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

sample

heroku pg:psql -c "\?" --app app-sample
Cockerel answered 24/3, 2018 at 1:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.