PostgreSQL, Fix change detection caused by superfluous bytea unescaping

and fix compatibility with pg-0.18.0.

This showed up when running BinaryTest#test_load_save with the more restrictive input string handling of pg-0.18.0.pre20141117110243.gem . It raises a ```ArgumentError: string contains null byte``` 

This also extends a test so that it shows this bug, independently of the pg version.

The same issue is present in 4.0 and 4.1 branch. It is solved in #17650, since that makes use of the ruby-pg en-/decoder capabilities.

The `ActiveRecord` namespace isn't required.