There is a catch around the code to handle all exception, but the log shows we didn’t catch it. According to the first blog, it is not possible to catch such exception.

Install PostgreSQL 9.0 from source code at Ubuntu

System: Ubuntu 10.04 and PostgreSQL 9.0.3

Download the source code from:

Unzip the source and go to a directory. All followings happen via command line terminal. So open a terminal:

hadoop@fxu-t60:~/Downloads/postgresql-9.0.3$ ./configure
configure: error: readline library not found
If you have readline already installed, see config.log for details on the failure.  It is possible the compiler isn't looking in the proper directory.
Use --without-readline to disable readline support.

Install readline package to fix this:

sudo apt-get install libreadline6-dev

Next problem you might see:

<pre>hadoop@fxu-t60:~/Downloads/postgresql-9.0.3$ ./configure
configure: error: zlib library not found
If you have zlib already installed, see config.log for details on the
failure.  It is possible the compiler isn't looking in the proper directory.
Use --without-zlib to disable zlib support.

Install zlib package to fix this:

sudo apt-get install zlib1g-dev

Now everything is ready to go:

sudo make
sudo make install

Then create the data directory to store all data files and do some configuration

sudo mkdir /usr/local/pgsql/data
sudo adduser postgres
sudo chown postgres /usr/local/pgsql/data
su - postgres

Then initialize the database:

postgres@fxu-t60:~$ /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data/
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale en_US.UTF-8.
The default database encoding has accordingly been set to UTF8.
The default text search configuration will be set to "english".

fixing permissions on existing directory /usr/local/pgsql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 32MB
creating configuration files ... ok
creating template1 database in /usr/local/pgsql/data/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
loading PL/pgSQL server-side language ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the -A option the
next time you run initdb.

Success. You can now start the database server using:

 /usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data
 /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start

Then create log directory and a sample database:

postgres@fxu-t60:~$ cd /usr/local/pgsql/data/
postgres@fxu-t60:/usr/local/pgsql/data$ mkdir log
postgres@fxu-t60:/usr/local/pgsql/data$ /usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data >/usr/local/pgsql/data/log/logfile 2>&1 &
[1] 16002
postgres@fxu-t60:/usr/local/pgsql/data$ cd ..
postgres@fxu-t60:/usr/local/pgsql$ bin/createdb mydb
postgres@fxu-t60:/usr/local/pgsql$ bin/psql mydb
psql (9.0.3)
Type "help" for help.


(optional) change postgres user password,type: sudo passwd postgres
(optional) To start the server automatically at every boot, add: su -c ‘/usr/local/pgsql/bin/pg_ctl start -l /usr/local/pgsql/data/log/logfile -D /usr/local/pgsql/data’ postgres to your /etc/rc.local file

How to insert source code in Google Docs or WordPress

For Google Docs like document, go to this website: input what you want and select the proper language. The output is colored with nice style. Simply copy them into your document.

For wordpress, just wrap your code with tag

To accomplish the above, just wrap your code in these tags "sourcecode" directly in the “visual” edit interface (HTML is not necessary), most common languages are supported, like java, php, python, etc. The attributes for this tag are: language, For more:

A sample:

package org.myorg;

public class test {

    public static void main(String[] args) throws Exception {
        String arg = "Hello World!";