>> 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 bytea: the data is meant to be binary data, not >> UTF8-encoded Unicode. >Inserting in bytea needs an extra level of escaping when the parameters
>are sent inline. See >http://www.postgresql.org/docs/8.4/interactive/datatype-binary.html
I have compared the 8.4 documentation for bytea with the 8.1 documentation, and as far as I can see, nothing of significance has changed.
>> When I was using Postgres 8.1.4 the same code worked. My code, the
>> mxODBC code and the driver are all unaltered: only the Postgres >> version has changed.. Is there something I can tweak to get it to >> work on Postgres 8.4.1? >Very odd. The syntax for this hasn't changed in a long time. And I
>would have thought you'd be sending your paramters out of line anyway. >Can you check that? The difficulty here is that several layers of software are involved. It is not as though I were writing in C and calling Postgres interface functions directly.
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 containing binary data). What mxODBC does with this I have no idea. It is a black box as far as I am concerned.
However, when I was running Postgres 8.1.4 it used to work. If I knew that something had changed in Postgres between 8.1.4 and 8.4.1, I could go to eGenix and ask whether the latest mxODBC version supports the change. However, if you are telling me that nothing in this area has changed in Postgres, I am baffled! |