Re: [SQL] Using UTF strings in pg8.3 - storing hexadecimal values in bytea columns

2008-11-11 Thread Mario Splivalo
Mario Splivalo wrote: But, if I want it other way around, I get the error: test1=# select envode(E'\305', 'hex'); ERROR: invalid byte sequence for encoding "UTF8": 0xc5 HINT: This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlle

Re: [SQL] Using UTF strings in pg8.3 - storing hexadecimal values in bytea columns

2008-11-11 Thread Mario Splivalo
Tom Lane wrote: Mario Splivalo <[EMAIL PROTECTED]> writes: Tom Lane wrote: 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)'); Yes, I mistakenly used

Re: [SQL] Using UTF strings in pg8.3 - storing hexadecimal values in bytea columns

2008-11-11 Thread Mario Splivalo
Richard Huxton wrote: Mario Splivalo wrote: Richard Huxton wrote: Mario Splivalo wrote: I have this issue: postgres=# select E'\xc5\x53\x94\x96\x83\x29'; ERROR: invalid byte sequence for encoding "UTF8": 0xc553 I think you want to be using octal escapes. That's text you're generating above.

Re: [SQL] Using UTF strings in pg8.3 - storing hexadecimal values in bytea columns

2008-11-10 Thread Richard Huxton
Mario Splivalo wrote: > Richard Huxton wrote: >> Mario Splivalo wrote: >>> I have this issue: >>> >>> postgres=# select E'\xc5\x53\x94\x96\x83\x29'; >>> ERROR: invalid byte sequence for encoding "UTF8": 0xc553 >> >> I think you want to be using octal escapes. That's text you're >> generating above

Re: [SQL] Using UTF strings in pg8.3 - storing hexadecimal values in bytea columns

2008-11-10 Thread Mario Splivalo
Tom Lane wrote: 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,

Re: [SQL] Using UTF strings in pg8.3 - storing hexadecimal values in bytea columns

2008-11-10 Thread Tom Lane
Mario Splivalo <[EMAIL PROTECTED]> 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 colu

Re: [SQL] Using UTF strings in pg8.3 - storing hexadecimal values in bytea columns

2008-11-10 Thread Tom Lane
Richard Huxton <[EMAIL PROTECTED]> writes: > Mario Splivalo wrote: >> That's true, but I'd still like to use hexadecimal notation. You could use decode(): regression=# select decode('c5a4', 'hex'); decode -- \305\244 (1 row) regards, tom lane -- Sent via pg

Re: [SQL] Using UTF strings in pg8.3 - storing hexadecimal values in bytea columns

2008-11-10 Thread Tom Lane
Mario Splivalo <[EMAIL PROTECTED]> writes: > Tom Lane wrote: >> 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)'); > Yes, I mistakenly used pg8.

[SQL] Using UTF strings in pg8.3 - storing hexadecimal values in bytea columns

2008-11-10 Thread Mario Splivalo
I have this issue: postgres=# select E'\xc5\x53\x94\x96\x83\x29'; ERROR: invalid byte sequence for encoding "UTF8": 0xc553 HINT: This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding". postgres=# show clien