Added support for non-numeric IDs used with Postgres

This replaces a previously submitted pull request which was sent to the Master branch. This is a non breaking change believed to belong in the 4.1 branch.