Postgres compatibility

Fixes #12.

Could someone please ensure this works with MySQL? I think it should but I don't have the ability to test it.