Thanks a lot Tom, I appended the -h /tmp and it worked.
I need just one more help from you.
Could you tell me that why & how that socket file existed in /tmp directory.
Because the server was configured that way:
See: unix_socket_directories
Thing is, the client code doesn’t read the postgresql.conf configuration file - it just knows its own compile-time default. For some reason, your client in one mode was compiled using a different default than the server on the same machine. From which we infer you have two client installs on your machine, each compiled using different defaults.
David J.