psql. It's installed everywhere I need to use it, it reads from stdin, and it writes to stdout. It's often the case that I want to take a SQL query that I've developed, generalize it a bit, and use something like
psql OPTIONS <<EOF
SELECT ...
EOF
in a shell script (probably wrapped in a function for convenience).