If any one here is doing serious DB based business logic with PostgreSQL (which I do recommend), I'd implore them to investigate and start using LATERAL JOIN.
Glad I found this blog. I am trying to build analytics engine for offline world and have chosen post-gres as my storage layer. These posts are invaluable and simply awesome. Thanks for sharing!!
http://blog.heapanalytics.com/postgresqls-powerful-new-join-...
This is no doubt a game changer in the way you organize (modularise for reuse) your views, functions and stored procedures.
In the MS SQL world it's CROSS APPLY.