You need to be more detailed what exactly you are trying to achieve, and what exactly the problem is. Which database user do you want to login with? What is the OS user you use to start psql?
–
a_horse_with_no_nameFeb 13 '13 at 12:42

After that, when issuing psql at the shell prompt, it will connect by default to your own database with your username. You no longer have to sudo to postgres until you need to issue other administrator commands.

Your psql is in /usr/bin/psql. You shouldn't need to use sudo unless your permissions are wrong, or unless your link is wrong. (In later versions of PostgreSQL, /usr/bin/psql is a symbolic link to the executable. I don't know whether that's true in 8.4. On my home computer, it links to /usr/share/postgresql-common/pg_wrapper.)

The full skeleton syntax for psql is

psql -U username -h hostname -p portnumber database_name

So, for example, when I connect to my scratch database (named "sandbox"), I do it like this.

$ psql -U postgres -h localhost -p 5432 sandbox

You would substitute

your database username (which must already exist, and which isn't necessarily the same as your network/computer username),

your hostname (but "localhost" is probably right for a local install of PostgreSQL),

the port PostgreSQL is listening on (but 5432 is probably right; it's the default), and

I would like to reframe the question. Is there any way i can login into Postgres with my username just like sudo psql taking everything else by default. Alias is one answer though, apart from that. Can we add my username into respective groups, would that help?
–
AntonyFeb 13 '13 at 12:55