rails/rails — pull request #14632 by matthewd (2014-04-07 15:15:02+00:00)
Title: Use connection-specific bytea escaping

In our normal usage, it's rare for this to make a difference... but is more technically correct:

> PQescapeBytea can only be used safely in client programs that use a single PostgreSQL connection at a time (in this case it can find out what it needs to know "behind the scenes"). It **might give the wrong results** if used in programs that use multiple database connections

(emphasis in [original](http://www.postgresql.org/docs/9.3/interactive/libpq-exec.html))

Per discussion on #7589.

The same concerns don't apply to `unescape_bytea`, but as `pg` provides it, we might as well use it for symmetry.

@senny