PostgreSQL: Type cast via ruby-pg

This pull request moves type casts for several data types into the scope of ruby-pg. This is done in three parts:

1. As generic type casts of common Ruby classes for database inputs and PostgreSQL outputs. This is similar to the type casting of mysql2 and sqlite3 gems.
2. As cached type maps alongside the prepared query statement.
3. As explicit type en/decoder for more complex data types like Array types.

This simple benchmark should get a speedup of 50%: https://gist.github.com/larskanis/aec0a74cb3454f696b08

True, I fixed this and added a test case for this [here](https://github.com/rails/rails/pull/17650/files#diff-215d4965017269169fdab6d8b3e2bda0R25) .