Fix derivation for newer PostgreSQL versions
Merge pull request #203 from whizz/master

Fix derivation for newer PostgreSQL versions