4

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?

2
  • 2
    select * from information_schema.tables postgresql.org/docs/current/static/information-schema.html Commented Jul 24, 2014 at 16:51
  • wow, thx, i got all info there! now i know the names of my tables! (not from git bash, using heroku webpage). can i see the columns of that tables? Commented Jul 24, 2014 at 17:17

2 Answers 2

6

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

Sign up to request clarification or add additional context in comments.

3 Comments

Ok!that was the reason of several error messages. thanks so much!!
Sure, no problem. Since it appears this answered your question, please accept my answer. More details on how to do that (among other info) can be found here: stackoverflow.com/tour
they changed command slightly in 2020, open cmd in windows and type heroku pg:psql -a <app_name> and then you can type SQL
4

As mentioned by the user

heroku pg:psql

select * from information_schema.tables;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.