Follow steps below to install Postgresql 9.4 (instead of 9.3 for which sources are added by default in Ubuntu 14.04):

1.  Remove the previous PostgreSQL Version:

*Make sure that you firstly backup your databases.

$ sudo apt-get --purge remove postgresql-*

2.  Add Repository:

$ sudo add-apt-repository "deb trusty-pgdg main"
$ wget --quiet -O - | sudo apt-key add -

3.  Update repository information:

$ sudo apt-get update

4.  Install PostgreSQL:

$sudo apt-get install postgresql-9.4

Postgresql 9.4 successfully installed.