I am using Cloud9 for Rails development and it uses an Ubuntu environment. In the documentation about using the PostgreSQL database, it says:
Connect to the service:
$ sudo sudo -u postgres psql
What is the meaning of typing sudo twice?
sudo -u postgres allows you to impersonate the postgres user when running the command. Your user probably doesn't have that privilege, but root's does.
So the first sudo gives you root's privileges and the second sudo allows you (as root) to sudo -u to postgres allowing the command to be run as the postgres user.
They have probably have only given your account sudo rights to the root account and so they think they need it to
sudo over to the postgres user in order to get there.
Considering how many people right their rules, you might run
sudo -l as the regular user to see if they gave you to access to all users or locked you down to root for some reason. I'm willing to be it's the former in which case you can leave off the first