Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get tables from postgresql in heroku?

I have windows, git bash,pg-admin 3, a Heroku app with a PostgreSQL database,Is there any git bash command to get the db and tables name? because i forgot the names and i can not make any query (select * from (?) )

I have tried:
\list command in git bash, but does not exist. Looking from Heroku web but no success.
Is there any way to get the names?

like image 416
Jona Santana Avatar asked Jan 10 '23 03:01

Jona Santana


2 Answers

git bash is simply a Cygwin-esque bash emulator that allows git to be run under Windows. Just as there is no native bash command to interact with Postgres, neither would there be one for git bash. You would need a separate program in either case.

Heroku has a special version of the regular Postgres psql called pg:psql which will let you run queries on the tables in your Heroku Postgres instance.

So you could run, for example:

SELECT * FROM users ORDER BY id;

More info on this tool is available here:

https://devcenter.heroku.com/articles/heroku-postgresql#pg-psql

More info on Postgres psql here:

http://www.postgresql.org/docs/9.3/static/app-psql.html

like image 169
khampson Avatar answered Jan 19 '23 02:01

khampson


As mentioned by the user

heroku pg:psql

select * from information_schema.tables;
like image 43
Smart Manoj Avatar answered Jan 19 '23 02:01

Smart Manoj