script for restore of postgres database localy from dump given on stdin - ambiguous redirect
I suggest this :

sshpass  -p "pass" ssh  x@1.2.3.4 "pg_dump -U foo some_db" | psql -U foo -d new_db


This will pipe ssh standard output into psql standard input.