Thread: BUG #5939: About bytea

BUG #5939: About bytea

From
"Vincent Chan"
Date:
The following bug has been logged online:

Bug reference:      5939
Logged by:          Vincent Chan
Email address:      joy717.xmu@gmail.com
PostgreSQL version: 9.0
Operating system:   Win7 x64
Description:        About bytea
Details:

when saving a bytes array,
for example a bytes array which length is 2,
but after saving,
it's length will be change to 3.
but in postgres 8.4, the array length is still 2.
Is this a bug?

Re: BUG #5939: About bytea

From
Peter Eisentraut
Date:
On tis, 2011-03-22 at 06:34 +0000, Vincent Chan wrote:
> when saving a bytes array,
> for example a bytes array which length is 2,
> but after saving,
> it's length will be change to 3.
> but in postgres 8.4, the array length is still 2.

Please show an actual example of what you are observing.

Re: BUG #5939: About bytea

From
Craig Ringer
Date:
On 22/03/2011 2:34 PM, Vincent Chan wrote:
>
> The following bug has been logged online:
>
> Bug reference:      5939
> Logged by:          Vincent Chan
> Email address:      joy717.xmu@gmail.com
> PostgreSQL version: 9.0
> Operating system:   Win7 x64
> Description:        About bytea
> Details:
>
> when saving a bytes array,
> for example a bytes array which length is 2,
> but after saving,
> it's length will be change to 3.
> but in postgres 8.4, the array length is still 2.
> Is this a bug?

I'd say you're using a client driver version that doesn't understand
hex-encoded escapes. Try setting bytea_output to 'escape' instead of 'hex'.

It'd help if you provided even some minimal information like code
samples, the language you're using, the version of the access driver
(npgsql/pgodbc/libpq/psycopg/php-pgsql/etc) you're using, and other
basic details.

Please read the PostgreSQL 9.0 release notes:
     http://www.postgresql.org/docs/9.0/static/release-9-0.html
and the documentation on bytea:
     http://www.postgresql.org/docs/9.0/static/datatype-binary.html

--
Craig Ringer

Tech-related writing at http://soapyfrogs.blogspot.com/