Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Just recently, I've read that PostgreSQL 9.2 is released. My Ubuntu 12.04 has PostgreSQL 9.1.5 installed. How can I update to 9.2 version? I tried apt-get update and apt-get upgrade but no updates for PostgreSQL.

share|improve this question

Here's the instructions for adding the postgresql apt repository:


Import the repository key from

wget -O - | sudo apt-key add -

Edit /etc/apt/sources.list.d/pgdg.list. The distributions are called codename-pgdg. In the example, replace squeeze with the actual distribution you are using:

deb squeeze-pgdg main

Configure apt's package pinning to prefer the PGDG packages over the Debian ones in /etc/apt/preferences.d/pgdg.pref:

Package: *
Pin: release
Pin-Priority: 500

Note: this will replace all your Debian/Ubuntu packages with available packages from the PGDG repository. If you do not want this, skip this step. Update the package lists, and install the pgdg-keyring package to automatically get repository key updates:

sudo apt-get update
sudo apt-get install pgdg-keyring

Once you've added that repository, you can do sudo apt-get install postgresql-9.2

share|improve this answer
I already have PostgreSQL installed, doing this will conflict my current installed? – Defensor Feb 23 '13 at 14:01
it will install in it's own folder for postgresql-9.2. If you find some of your commands (like pg_dump) point to postgresql-9.1 programs, you can change the symlink or just run the command from within the postgresql-9.2 directory. definitely back up databases before installing the new version just to be sure. – Danny Feb 23 '13 at 16:58
I take issue with that deprecation warning, since the PPA goes up to Quantal and the newer repo doesn't. Both are late to Raring, which breaks the recommended script. – Tobu Apr 22 '13 at 20:55
Just for future reference, I was getting the error saying /var/lib/postgresql/9.2/main is not accessible or does not exist Solved it using sudo apt-get remove --purge postgresql-9.2 postgresql-9.1 sudo apt-get install postgresql-9.2 – Pankaj Jul 18 '13 at 5:08
Note, piping into sudo is not recommended. On my system, that causes the sudo prompt to be hidden, making the entire command appear to hang indefinitely. – Cerin Apr 27 '14 at 1:54

There is a new, official repository. It contains the newest versions of postgresql including 9.3 as of February 2014. Please read the detailed official instructions. For Ubuntu 12.04 I used:

sudo bash -c 'echo "deb precise-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
sudo apt-get update
sudo apt-get install postgresql-9.3 pgadmin3
share|improve this answer
What provides the 9.3 version of pg_dump? Dpkg says it's still being provided by postgresql-client-common, which is stuck at 9.1. – Cerin Apr 27 '14 at 2:08
@Cerin package postgresql-client-9.3 contains pg_dump – geekQ Apr 27 '14 at 10:14
Ah you're right. But it didn't update the symlinks in /usr/bin, which I'll just have to do manually. – Cerin Apr 27 '14 at 15:58

Try this:

sudo -u postgres psql --cluster 9.2/main 
share|improve this answer
I get this : Error: Invalid version specified with --cluster – Defensor Sep 12 '12 at 15:25
On Askubuntu the individual asking a question will see every answer without needing to be individually addressed. Similarly you will be notified of every comment on your answer. Welcome to the site! Do you have any suggestion about Defensor's version error message? – John S Gruber Oct 9 '12 at 19:57
This is just wrong. He's asking how to upgrade, not to connect to a 9.2 cluster. – nilbus Jan 16 '13 at 2:22
AS far as I know, ppa:pitti installs the 9.2 in parallel to 9.1 - it just runs on another port. try 'psql -p 5433'. – alfonx Feb 8 '13 at 17:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.