Re: [GENERAL] bytea and character encoding when inserting escaped literals

2008-05-07 Thread Raymond O'Donnell
On 05/05/2008 16:07, Lee Feigenbaum wrote: INSERT INTO myTable VALUES (..., E'\x15\x1C\x2F\x00\x02...', ...) ; As I understand it, the octets need to be entered as their octal representation - have a look at table 8-7 at http://www.postgresql.org/docs/8.3/static/datatype-binary.html. HTH,

[GENERAL] bytea and character encoding when inserting escaped literals

2008-05-05 Thread Lee Feigenbaum
Hi, I've searched the archives a fair amount on this topic, but have not found quite the answer / explanation I'm looking for. I attribute this to my eternal confusion over character encoding issues in all environments, so I apologize in advance for what might be a stupid question. :) I'mm

Re: [GENERAL] bytea and character encoding when inserting escaped literals

2008-05-05 Thread Asche
Hi Lee, On 05.05.2008, at 17:07, Lee Feigenbaum wrote: INSERT INTO myTable VALUES (..., E'\x15\x1C\x2F\x00\x02...', ...) ; try escaping the backslashes: INSERT INTO myTable VALUES (..., E'\\x15\\x1C\\x2F\\x00\\x02...', ...) ; Jan -- Sent via pgsql-general mailing list

Re: [GENERAL] bytea and character encoding when inserting escaped literals

2008-05-05 Thread Lee Feigenbaum
Asche wrote: Hi Lee, On 05.05.2008, at 17:07, Lee Feigenbaum wrote: INSERT INTO myTable VALUES (..., E'\x15\x1C\x2F\x00\x02...', ...) ; try escaping the backslashes: INSERT INTO myTable VALUES (..., E'\\x15\\x1C\\x2F\\x00\\x02...', ...) ; Hi Jan, Thanks for the suggestion. I should have

Re: [GENERAL] bytea and character encoding when inserting escaped literals

2008-05-05 Thread Asche
Hi Lee, Thanks for the suggestion. I should have mentioned in my original message that as per your suggestion and the suggestion in the documentation, I have tried escaping the backslashes. When I do this, I get the error: ERROR: invalid input syntax for type bytea I tried also doing

Re: [GENERAL] bytea and character encoding when inserting escaped literals

2008-05-05 Thread Andy Anderson
I'm thinking that the answer is in the literal interpretation of the error message, i.e. it doesn't like the specific byte 0x00, i.e. the null byte. According to the docs (4.1.2.1. String Constants): The character with the code zero cannot be in a string constant. The reason may be that

Re: [GENERAL] bytea and character encoding when inserting escaped literals

2008-05-05 Thread Lee Feigenbaum
Asche wrote: Hi Lee, Thanks for the suggestion. I should have mentioned in my original message that as per your suggestion and the suggestion in the documentation, I have tried escaping the backslashes. When I do this, I get the error: ERROR: invalid input syntax for type bytea I tried

Re: [GENERAL] bytea and character encoding when inserting escaped literals

2008-05-05 Thread Tom Lane
Lee Feigenbaum [EMAIL PROTECTED] writes: Would be nice if the bytea parser understood hex representation too, but beggars can't be choosers :) decode() might help you: select decode('1200AB', 'hex'); decode -- \022\000\253 (1 row) regards, tom