add postgres support
tested on PostgreSQL 9.3