pgBash is a bash shell with builtin SQL features for PostgreSQL WWW: http://www.psn.co.jp/PostgreSQL/pgbash/