Please consider integrating PostgreSQL specific syntax coloring for editing SQL. This capability is already implemented in the Ace editor which is designed to be embedded in HTML applications. See
http://ajaxorg.github.com/ace/
To try the live demo, just select "pgSQL" from the Document menu:
http://ajaxorg.github.com/ace/build/kitchen-sink.html
The current implementation supports SQL, pl/pgsql, pl/perl, and pl/python.