Use connection-specific bytea escaping

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

As well as a spec that proves this is a good idea, let's also add a more
sane-looking one that just covers basic to_sql functionality. There
aren't many places where we actually use escape_bytea, but that's one
that won't be going away.
Merge pull request #14632 from matthewd/escape_bytea

Use connection-specific bytea escaping