Correct some bugs of postgres_get_port

Code tab was incorrect as well as redirection of output with psql command.