On 26.6.2013 13:32, Alban Hertroys wrote: > On 26 June 2013 12:39, Jiří Pavlovský <j...@pavlovsky.eu > <mailto:j...@pavlovsky.eu>> wrote: > > On 26.6.2013 12:19, Alban Hertroys wrote: >> On 26 June 2013 11:17, Jiří Pavlovský <j...@pavlovsky.eu >> <mailto:j...@pavlovsky.eu>> wrote: >> >> On 26.6.2013 10:58, Albe Laurenz wrote: >> > Jirí Pavlovský wrote: >> >> I have a win32 application. >> >> LOG: statement: INSERT INTO recipients (DealID, >> >> Contactid) VALUES (29009, 9387) >> >> ERROR: invalid byte sequence for encoding "UTF8": 0x9c >> >> >> >> >> >> But the query is clean ascii and it doesn't even contain >> the mentioned >> >> character. >> >> >> Can you show a \d+ of the recipients table? I suspect there is a >> trigger attached to inserts on the table or some other >> side-effect that's causing the issue. >> > > Here you go. But I don't think that is the cause. I'm getting > these errors on tables as well. Actually when I copy and paste the > offending queries from log into pgAdmin it runs without an error. > > > I suppose that contacts.contactid and subscription.dealid are integers > as well and not, for example, text fields? Yes integers. > > So the queries work from pgadmin; what application/environment are > they NOT working in? Something is obviously different. You say it's a > Win32 application, what database libraries and programming languages > are involved? I'm using plain c and libpq from 9.2.2. And gtk as a GUI. Compiler is mingw (gcc for windows). > > Does the application perhaps send trailing garbage after the query or > something similar? Something like that might happen if there's a > memory allocation bug in the application. > I'm assuming here that, if the query string cannot be converted from > utf-8 due to garbage characters, the transcoding error triggers before > the query parser notices a syntax error.
Could be. But when I look at the query string in gdb, before it is send, I don't see there anything problematic. I guess I'll have to try to wite some test cases to try to locate the problem.