I am trying to understand how I can create a new database in PostgreSQL and have it owned by a specific user and not the user I am connected to the database as.
For example, I am logged into the 'postgres' database as the user 'postgres'. I want a new database called 'finance' and have it owned by a user that doesn't exist yet named 'maggie'. I searched the 'docs' and couldn't find any info that showed me how I could accomplish this task.
When I tried the following, I get an error:
postgres=# CREATE DATABASE finance WITH OWNER = maggie;
ERROR: role "maggie" does not exist
Not sure if it matters, but I am using psql (8.4.4).