This is really cool, thanks for pointing me to that. I'm still probably going to migrate to postgres because I'd like the functions to exist in the db and not just in code, so I can use them in ad-hoc queries.
But this is worth considering as an option.