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 https://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" $ wget --quiet -O - https://postgresql.org/media/keys/ACCC4CF8.asc | 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.