Postgresql support! Some of it is a hack :(