Here are some useful links to online or downloadable documentation:

PostgreSQL:  http://www.postgresql.org/docs/manuals/