A while ago I’ve been fixing and publishing pgsql-linum-format separately. That allows to number PL/whatever code lines when editing from Emacs, and it’s something very useful to turn on when debugging. The carrets on the fringe in the emacs window are the result of (setq-default indicate-buffer-boundaries 'left) and here it’s just overloading the image somehow. But the idea is to just M-x linum-mode when you need it, at least that’s my usage of it.
Those are my two all times favorite Open Source Software. Or Free Software in the GNU sense of the world, as both the BSD and the GPL are labeled free there. Even if I prefer the The Debian Free Software Guidelines as a global definition and the WTFPL license. But that’s a digression. I think that Emacs and PostgreSQL do share a lot in common. I’d begin with the documentation, which quality is amazing for both projects.