Currently libpq provides a function to escape byteas to include directly in
the query string. But if you're using PQexecParam you still need to do one
layer of quoting but don't need to double the backslashes which PQescapeBytea
does if you have standard_conforming_strings set off.
Do we want something like this which provides a PQescapeByteaParam for
escaping bytea strings before passing them as text-mode parameters in
PQexecParam?
I cheated here and just passed true to standard_conforming_strings which
happens to do what we want. It might be better to provide an additional
parameter to PQescapeByteaInternal which tells it to only escape \ and NUL and
not other binary characters and '.
I didn't document it yet, I'll do that if people agree we want it.
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com