Archive for March, 2013

postgresql: create user, db, schema (command line)

Saturday, March 16th, 2013
# create the user
CREATE USER some_user WITH password 'pwd'

# create the new db with the new user as owner
CREATE DATABASE some_db WITH OWNER some_user;

# connect to db
connect some_db

# create schema
CREATE SCHEMA some_schema AUTHORIZATION some_user;

# rename database
ALTER DATABASE dbname RENAME TO new_dbname;