3

I have problems with querying my PostgreSQL running in Docker. What im doing is connecting to my db

$ docker exec -it my_db_1 psql -U postgres -d project

I have table block, which has id, name and size for example. My query is like:

SELECT * FROM block WHERE id=1

Where can i see my outputs?

1
  • if you docker exec -it my_db_1 bash and then psql -U postgres -d project and SELECT * FROM block WHERE id=1 does it show more? Commented Jan 27, 2017 at 10:19

1 Answer 1

5

You get output to your terminal STDOUT.

You can get it in one step only by

docker exec -it my_db_1 psql -U postgres -d project -c "SELECT * FROM block WHERE id=1"
Sign up to request clarification or add additional context in comments.

1 Comment

Or -f if you want to execute a sql file

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.