Postgres support

Fixes the issues preventing identity_cache being used with Postgres:

* Remove hardcoded backticks in SQL statements and let ActiveRecord decide how values should be quoted based on the current DB adapter instead.
* Tweak tests to be DB aware – when using Postgres, `#select_value` and `#select_values` return IDs as Strings rather than Integers.

You can now run the tests by setting the `DB` env variable to `postgres`. e.g. `rake DB=postgres`.