/* Code-Comments */

November 30, 2019

Postgres Interactive Shell, Start, Stop, And Docker

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!

Stephen Weiss

Thanks for reading! My name's Stephen Weiss. I live in Chicago with my wife, Kate, and dog, Finn.
Click here to see the archives of my weeks in review and sign up yourself!