Merlin Moncure recently posted a blog entry about
psql now in color.
I tried it but got some issues when run. man pages in particular were failing to show properly.
The solution was quite simple: unset LESS and PAGER variables *after* running psql.
so my .bashrc now has this nice function in it
psql() {
YELLOW=$(printf "\e[1;33m" )
LIGHT_CYAN=$(printf "\e[1;36m" )
NOCOLOR=$(printf "\e[0m" )
export LESS="-iMSx4 -FXR"
PAGER="sed \"s/\([[:space:]]\+[0-9.\-]\+\)$/${LIGHT_CYAN}\1$NOCOLOR/;"
PAGER+="s/\([[:space:]]\+[0-9.\-]\+[[:space:]]\)/${LIGHT_CYAN}\1$NOCOLOR/g;"
PAGER+="s/|/$YELLOW|$NOCOLOR/g;s/^\([-+]\+\)/$YELLOW\1$NOCOLOR/\" 2>/dev/null | less"
export PAGER
env psql "$@"
unset LESS PAGER
}