Re: Using UTF strings in pg8.3 - storing hexadecimal values in bytea columns - Mailing list pgsql-sql

From Tom Lane
Subject Re: Using UTF strings in pg8.3 - storing hexadecimal values in bytea columns
Date
Msg-id 7011.1226332080@sss.pgh.pa.us
Whole thread Raw
In response to Using UTF strings in pg8.3 - storing hexadecimal values in bytea columns  (Mario Splivalo <mario.splivalo@megafon.hr>)
Responses Re: Using UTF strings in pg8.3 - storing hexadecimal values in bytea columns
List pgsql-sql
Mario Splivalo <mario.splivalo@megafon.hr> writes:
> I have this issue:
> postgres=# select E'\xc5\x53\x94\x96\x83\x29';
> ERROR:  invalid byte sequence for encoding "UTF8": 0xc553

This is expected since the string is not valid as text.

> I'm using the above mentioned string to store data into bytea column. I 
> did pg_dump of the database on postgres 8.2, and then tried to restore 
> it on postgres 8.3, and I got this error. The actuall line that produces 
> error is like this:

> INSERT INTO vpn_payins_bitfield (vpn_id, payload_pattern, encription, 
> encription_key, charset, amount_width, shop_width, counter_width) VALUES 
> (3, E'\\W*(\\w+)(?:\\W+(.*))?', 'RC4', 
> E'\xc5\x53\x94\x96\x83\x29'::bytea, 'ABCDEGHIKLMOPTWX', 16, 8, 16);

Exactly what version of pg_dump are you using?  What I get from pg_dump
doesn't look like that.  Bytea fields with -D look more like this:

INSERT INTO foo (f1) VALUES ('\\305S\\224\\226\\203)');
        regards, tom lane


pgsql-sql by date:

Previous
From: "Fernando Hevia"
Date:
Subject: Re: Subsorting GROUP BY data
Next
From: tv@fuzzy.cz
Date:
Subject: Re: Subsorting GROUP BY data