2.1 create PSQL app user & empty databases

wb todoMVC Master >> 2.1 create PSQL app user & empty….

Postgres gotchas

  • Semicolon Semicolon Semicolon:
    If you run into odd issues, chances are you forgot to end your execution statement with a semicolon.
  • To quotes or not?
    If you find that referencing a database name or table name is resulting in not found, chances are you have an issue with case sensitivity. Try using the correct casing of the db object ref and wrapping it in double quotes.

Create app user

Open terminal on mac and start psql as Superuser

$ psql -U postgres

Verify that you are logged in as Superuser postgres

# select current_user;

Create app specific user todo_system

# CREATE USER todo_system WITH PASSWORD 'todo_system_password';

Create empty databases

Create an empty database for dev environment


Create an empty database for test environment

# CREATE DATABASE todo_test;

Grant permissions to your app user for the new databases

Grant todo_system all permissions for dev DB

# GRANT ALL ON DATABASE todo_dev TO todo_system;

Grant todo_system all permissions for test DB

# GRANT ALL ON DATABASE todo_test TO todo_system;

Logout/quit psql

# \q

Verify user permissions

Verify todo_system can only log in to approved DB

$ psql -U todo_system

Should result in:

psql: FATAL: database todo_system does not exist


$ psql -U todo_system -d todo_dev

Should result in: Successful login

Create a test table

> CREATE TABLE testtest (id serial PRIMARY KEY);

Drop test table

> DROP TABLE testtest;

Tutorial Navigation

The master tutorial doc is located here: WB todoMVC MASTER

Previous Step: 1.8 define /todo/{id} PUT endpoint

Next Step: 2.2 dotenv install & config with PSQL connect data

A single golf clap? Or a long standing ovation?

By clapping more or less, you can signal to us which stories really stand out.