Fix value extracted from negative integers for PostgreSQL.

Fixes: https://github.com/rails/rails/issues/17856.