PQescapeBytea* version for parameters - Mailing list pgsql-hackers

From Gregory Stark
Subject PQescapeBytea* version for parameters
Date
Msg-id 87fy44chki.fsf@oxford.xeocode.com
Whole thread Raw
Responses Re: PQescapeBytea* version for parameters  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
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

Attachment

pgsql-hackers by date:

Previous
From: Gregory Stark
Date:
Subject: Dead code as a result of plan cache invalidation?
Next
From: Darcy Buskermolen
Date:
Subject: Re: Why so many out-of-disk-space failures on buildfarm machines?