PostgreSQL

My PostgreSQL notes, both troubleshooting and SQL commands.

Alter table

Adding fields to a table. Also see the PostgreSQL manual (alter table)

  alter table eventInstance
    add externalId varchar
    add scheduleId varchar;

Running a script

Often, you want to write an sql script that creates the entire schema etc, this can be easily done with:

  psql -U myuser -d mydatabase < myscript.sql