PostgreSQL on the command line

I am just getting back into PostgreSQL. Here are the things I had to learn today:

1. Command line usage:

  • su - postgres
  • psql
  • select version();

2. Dumping data for import on another server

  • pg_dump -o mydb -U postgres -W > mydb.sql

  • -o has to do with oids (Not sure if I need this yet)

  • -U is for user

  • -W is for password. It prompts when you run the command