Does this work with emacs? I love the integration of psql and emacs, but this would be even better. http://www.emacswiki.org/emacs/SqlMode
For now it serve me well.
I don't have a working setup of emacs to try it right away. If you can try it out and find that it's not working, please file an issue.