postgres interactive shell, start, stop, and docker

2019-11-30

 | 

~1 min read

 | 

170 words

Recently I was working with a Docker image of a Postgres database. Everything was going great. docker image

At one point, I wanted to investigate different data types of Postgres.

Instead of trying to figure out how to do that within DBeaver (which was how I was interacting with the Docker), I thought I would just start up my psql shell and get the answer that way.

That worked, but later when I tried to query my database, I started getting fatal errors. My role didn’t exist.

role does not exist

A quick search on StackOverflow suggested that this error can occur when there’s a conflict between Postgres instances.

The suggestion was to run brew services stop PostgreSQL - which would make sense if you used homebrew to start Postgres in the beginning. I didn’t. I used pg_ctl -D /usr/local/var/postgres start - so now, I needed to reverse that with pg_ctl -D /usr/local/var/postgres stop.

Once the second instance of Postgres was killed, everything went back to normal.

Hip, hip, hooray!



Hi there and thanks for reading! My name's Stephen. I live in Chicago with my wife, Kate, and dog, Finn. Want more? See about and get in touch!