Installing and Using Postgres database
Summary of how to install Postgres database for use with SQL API.
Download postgres release from:
http://www.postgresql.org/download/
For example, in January 2008 the stable release was postgresql-8.2.6.tar.gz.
Unpack this:
tar xvzf postgresql-8.2.6.tar.gz (or whatever file)
Compile and install:
cd ~/postgresql-8.2.6 (or whatever directory)
./configure --prefix ~/pgsql (assuming you want installation in this directory)
make
make install
All commands are in ~/pgsql/bin, so can add that to your path, or just add path explicitly when you run commands.
Initialise database:
cd ~/pgsql/bin
initdb -D ~/pgsql/data
To start server:
postmaster -D ~/pgsql/data >logfile 2>&1&
To create database "test":
createdb test
To create user "postgres":
[ asked "Shall the new role be a superuser? (y/n) ]
To start interactive client on database "ccpntest":
psql ccpntest
To describe all tables in database "ccpntest" from inside psql client:
ccpntest=# \dt
To describe specific table in database "ccpntest" from inside psql client:
ccpntest=# \d TABLE_NAME