Merge pull request #10505 from patricksrobertson/bigserial_id_not_identifying_pk

Handle other pk types in PostgreSQL gracefully.

Closes #10505.

- rebased
- test slightly modified

Conflicts:
	activerecord/CHANGELOG.md
Merge pull request #13334 from gregolsen/postgresql_infinity

pg, fix Infinity and NaN values conversion.

Closes #13334.

* rebased
* removed guard
* inlined guard into case statement