Re: [GENERAL] Error "invalid byte sequence for encoding UTF8" on insert into BYTEA column

2010-01-23 Thread Alan Millington
>You probably need to ask the mxODBC developers (who AFAIK don't hang out >on this list) what they are doing with that data.  It sounds fairly >likely to me that the bytea value is just being sent as a string without >any special encoding.  That would explain both the null sensitivity you >mention

Re: [GENERAL] Error "invalid byte sequence for encoding UTF8" on insert into BYTEA column

2010-01-22 Thread Tom Lane
Alan Millington writes: > What I send to mxODBC is the command as a string containing placeholders > (question marks), e.g. "insert into mytable (intcol, byteacol) values (?, > ?)", plus the actual values as separate arguments, e.g. 1, data (where 1 is a > literal and data is a Python variable

Re: [GENERAL] Error "invalid byte sequence for encoding UTF8" on insert into BYTEA column

2010-01-22 Thread Alan Millington
Having done some investigation, I can shed further light on the problem.   Within an interactive Python session I connected to the database using mxODBC: the variable csr is an mxODBC cursor object. I made the following assignments:   sql = 'insert into mytable (seq_num, data) values (?, ?)' data

Re: [GENERAL] Error "invalid byte sequence for encoding UTF8" on insert into BYTEA column

2010-01-22 Thread Alan Millington
>> Today for the first time since upgrading to Postgres 8.4.1 I tried >> out part of the code which inserts some binary data into a table. The >> insert failed with the error "invalid byte sequence for encoding >> UTF8". That is odd, because the column into which the insert was made >> is of type b

Re: [GENERAL] Error "invalid byte sequence for encoding UTF8" on insert into BYTEA column

2010-01-21 Thread Martijn van Oosterhout
On Thu, Jan 21, 2010 at 11:54:32AM -0800, Alan Millington wrote: > Today for the first time since upgrading to Postgres 8.4.1 I tried > out part of the code which inserts some binary data into a table. The > insert failed with the error "invalid byte sequence for encoding > UTF8". That is odd, beca

[GENERAL] Error "invalid byte sequence for encoding UTF8" on insert into BYTEA column

2010-01-21 Thread Alan Millington
I am running Postgres 8.4.1 on Windows XP Professional Service Pack 3. My database is UTF8. My program code is written in Python, and to interface to Postgres I use mxODBC 3.0 and the PostgreSQL Unicode driver PSQLODBCW.DLL version 8.01.02.00 dated 31/01/2006.   Today for the first time since up