Guys,
Let's not re-invent the wheel here, hey?
http://techdocs.postgresql.org/guides/PLLanguages
-- Josh BerkusAglio Database SolutionsSan Francisco