pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #15261: Insert binary data in bytea rejected due to UTF-8 encoding errors
2+ messages / 2 participants
[nested] [flat]
* BUG #15261: Insert binary data in bytea rejected due to UTF-8 encoding errors
@ 2018-07-04 11:02 PG Bug reporting form <noreply@postgresql.org>
0 siblings, 1 reply; 2+ messages in thread
From: PG Bug reporting form @ 2018-07-04 11:02 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org; +Cc: brice@famille-andre.be
The following bug has been logged on the website:
Bug reference: 15261
Logged by: Brice André
Email address: brice@famille-andre.be
PostgreSQL version: 9.6.7
Operating system: debian stretch
Description:
Dears,
I have a database using UTF-8 encoding and, in which I have bytea columns
where I store binary data.
I followed instructions in
https://www.postgresql.org/docs/9.6/static/datatype-binary.html to encode
the binary data, but it is still rejected due to a "ERROR: invalid byte
sequence for encoding "UTF8"" error.
I wrote a small script that reproduces the problem in a small database. The
script can be simply copy-pasted in a psql session:
CREATE DATABASE test WITH TEMPLATE = template0 ENCODING = 'UTF8' LC_COLLATE
= 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8';
\connect test;
CREATE TABLE test (test bytea);
insert into test (test) values (E'\xC744'::bytea);
Regards,
Brice
^ permalink raw reply [nested|flat] 2+ messages in thread
* RE: BUG #15261: Insert binary data in bytea rejected due to UTF-8 encoding errors
@ 2018-07-04 11:13 gpd@gpdnet.co.uk
parent: PG Bug reporting form <noreply@postgresql.org>
0 siblings, 0 replies; 2+ messages in thread
From: gpd@gpdnet.co.uk @ 2018-07-04 11:13 UTC (permalink / raw)
To: brice@famille-andre.be; pgsql-bugs@lists.postgresql.org
>
> I have a database using UTF-8 encoding and, in which I have bytea columns
> where I store binary data.
>
> I followed instructions in
> https://www.postgresql.org/docs/9.6/static/datatype-binary.html to encode
> the binary data, but it is still rejected due to a "ERROR: invalid byte sequence
> for encoding "UTF8"" error.
>
> I wrote a small script that reproduces the problem in a small database. The
> script can be simply copy-pasted in a psql session:
>
> CREATE DATABASE test WITH TEMPLATE = template0 ENCODING = 'UTF8'
> LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8'; \connect test;
> CREATE TABLE test (test bytea); insert into test (test) values
> (E'\xC744'::bytea);
>
You'll notice in the link you provided for your example that you need an extra backslash ('\') for the escape format you are using.
Regards,
Gary.
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2018-07-04 11:13 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-07-04 11:02 BUG #15261: Insert binary data in bytea rejected due to UTF-8 encoding errors PG Bug reporting form <noreply@postgresql.org>
2018-07-04 11:13 ` gpd@gpdnet.co.uk
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox