Re: [GENERAL] Gripe: bytea_output default => data corruption

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: ljb <ljb9832(at)pobox(dot)com>
Cc: pgsql-docs(at)postgresql(dot)org
Subject: Re: [GENERAL] Gripe: bytea_output default => data corruption
Date: 2011-02-04 21:14:23
Message-ID: 201102042114.p14LENv21963@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

ljb wrote:
> bruce(at)momjian(dot)us wrote:
> >...
> >> Based on this report, I have created the attached documentation patch
> >> which clarifies the libpq behavior for escaping bytea. I am planning to
> >> backpatch this to 9.0 as well.
>
> This change says PQescapeBytea is unable to adjust its behavior based on
> bytea_output, implying that PQescapeByteaConn does adjust its behavior
> based on byte_output. Wrong! Neither one knows or cares about the bytea_output
> parameter, which is solely for the backend to tell it how to present bytea
> data to the front-end. Not for the front-ends at all.

Good point, sorry.

> (See why we need this behavior documented?)

Yep!

> Non-use of 'standard_conforming_strings' is also wrong, in the current
> (pre-patched) docs. PQescapeBytea does adjust its behavior for
> standard_conforming_strings, but only for the single-connection case. See
> similar text for PQescapeString.

Yep.

> Regarding the first paragraph changed, it seems off to me. "PQescapeByteConn
> escapes such bytes using either hex encoding..." tells me that when hex
> encoding is used, PQescapeByte encodes only bytes that need escaping. Not
> true - hex encoding encodes (not escapes) every byte.

OK, great feedback. I made the adjustments you suggested and tried to
pattern it after PQescapeStringConn, with adjustments where appropriate.

Here is an updated patch, again to be backpatched to 9.0. There were
obviously big mistakes in libpq docs and I am embarrassed I waited so
long to fix this; my apologies.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +

Attachment Content-Type Size
/rtmp/libpq.diff text/x-diff 6.2 KB

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Bruce Momjian 2011-02-04 21:23:34 Re: Change to documentation headers
Previous Message Peter Eisentraut 2011-02-04 16:01:39 Re: Change to documentation headers