Thread: BUG #4180: PANIC while PQExec on Client with differen locale from database
The following bug has been logged online: Bug reference: 4180 Logged by: bishop Email address: polimax@mail.ru PostgreSQL version: 8.3.1 Operating system: Vista Home Premium Description: PANIC while PQExec on Client with differen locale from database Details: The code PQsetClientEncoding(conn,"WIN1251"); res = PQexec(conn, "INSERT INTO \"table_name\" (\"name\") VALUES ('test');"); return such error message (sorry for localised part of message) PANIC: ERRORDATA_STACK_SIZE exceeded ÑеÑÐ²ÐµÑ Ð½ÐµÐ¾Ð¶Ð¸Ð´Ð°Ð½Ð½Ð¾ закÑÑл Ñоединение СкоÑее вÑего ÑÑо ознаÑаеÑ, ÑÑо ÑеÑÐ²ÐµÑ Ð·Ð°Ð²ÐµÑÑил ÑабоÑÑ Ñо Ñбоем до или в пÑоÑеÑÑе вÑÐ¿Ð¾Ð»Ð½ÐµÐ½Ð¸Ñ Ð·Ð°Ð¿ÑоÑа. Server encoding UTF8, database encoding UTF8 client encoding WIN1251 The previouse version 8.2 work well with this code.
"bishop" <polimax@mail.ru> writes: > PQsetClientEncoding(conn,"WIN1251"); > res = PQexec(conn, "INSERT INTO \"table_name\" (\"name\") VALUES > ('test');"); What do you get, exactly, if you do the same command but with client_encoding = UTF8? I suppose this must be a problem with failing to convert the encoding of an error message, but without knowing what the original error message is, it's hard to investigate. regards, tom lane
[ please keep the mailing list cc'd on discussions ] "bishop.gis" <bishop.gis@gmail.com> writes: > This is result executing the same command with client_encoding = UTF8. > ERROR: =CE=C5=D7=C5=D2=CE=C1=D1 = > =D0=CF=D3=CC=C5=C4=CF=D7=C1=D4=C5=CC=D8=CE=CF=D3=D4=D8 =C2=C1=CA=D4 = > =C9=CD=D1 =CB=CF=C4=C9=D2=CF=D7=CB=C9 "UTF8": 0xcdee (on > English -- invalid UTF-8 byte sequence detected near byte 0xcdee) > =F0=EF=E4=F3=EB=E1=FA=EB=E1: This error can also happen if the byte = > sequence does not match > the encoding expected by the server, which is controlled by > "client_encoding". Hmm ... I don't read Russian, but I'm quite certain that what you sent isn't in UTF8. Perhaps it is in KOI8-R? This lends some weight to the theory I suggested that gettext() is failing to return UTF8 on Windows. That could be a red herring, since it's possible the encoding got changed when you copied the text into your mail message, but the theory seems to explain the observed facts so far. What locale settings are you using --- particularly lc_ctype and lc_messages? regards, tom lane
Re: BUG #4180: PANIC while PQExec on Client with differen locale from database
From
Christoph Becker
Date:
I got almost the same error: I dumped the database, which was in Latin9, with version 8.2.6 using UTF8 as encoding. Then loaded the database to version 8.3.1. Now the database was running with UTF8 while on the client still was iso-8859-15. As as result postgresql..exe did crash very often. Then I tried: $ pg_dump -U postgres -f pxdump-2008-05-19a-Latin9.txt -E='Latin9' px and got the following message: pg_dump: SQL command failed pg_dump: Error message from server: ERROR: character 0xc2a4 of encoding "UTF8" has no equivalent in "LATIN9" pg_dump: The command was: COPY public.p_behbl_log (lfdnr_log, lfdnr_behbl, patnr , datum, zahn_, zahn, behandlung, gebuehrenpos, ltyp, efs_bemerkung, anz, faktor , bemerkung, begruendung, material, punktzahl, punktsumme, punktwert, betrag, wa ehrung, fallnr, behandler, assistenz, createtime, sitzungskennz, unfallkennz, no tfallkennz, digest, digest_seq, abgerechnet, log_timestamp, log_user, log_reason ) TO stdout; in the Logfile I found: 2008-05-20 14:49:58 CEST ERROR: character 0xc2a4 of encoding "UTF8" has no equivalent in "LATIN9" 2008-05-20 14:49:58 CEST STATEMENT: COPY public.p_behbl_log (lfdnr_log, lfdnr_behbl, patnr, datum, zahn_, zahn, behandlung, gebuehrenpos, ltyp, efs_bemerkung, anz, faktor, bemerkung, begruendung, material, punktzahl, punktsumme, punktwert, betrag, waehrung, fallnr, behandler, assistenz, createtime, sitzungskennz, unfallkennz, notfallkennz, digest, digest_seq, abgerechnet, log_timestamp, log_user, log_reason) TO stdout; 2008-05-20 14:49:58 CEST LOG: could not receive data from client: Unknown winsock error 10061 2008-05-20 14:49:58 CEST LOG: unexpected EOF on client connection dumping just in utf8 did work. Obviously, the converison from Latin9 (and other encodings?) to UTF8 did produce some characters which can not be encoded back to the original encoding. Regards, Christoph Becker Tom Lane schrieb: > [ please keep the mailing list cc'd on discussions ] > > "bishop.gis" <bishop.gis@gmail.com> writes: > >> This is result executing the same command with client_encoding = UTF8. >> ERROR: =CE=C5=D7=C5=D2=CE=C1=D1 = >> =D0=CF=D3=CC=C5=C4=CF=D7=C1=D4=C5=CC=D8=CE=CF=D3=D4=D8 =C2=C1=CA=D4 = >> =C9=CD=D1 =CB=CF=C4=C9=D2=CF=D7=CB=C9 "UTF8": 0xcdee (on >> English -- invalid UTF-8 byte sequence detected near byte 0xcdee) >> =F0=EF=E4=F3=EB=E1=FA=EB=E1: This error can also happen if the byte = >> sequence does not match >> the encoding expected by the server, which is controlled by >> "client_encoding". >> > > Hmm ... I don't read Russian, but I'm quite certain that what you sent > isn't in UTF8. Perhaps it is in KOI8-R? > > This lends some weight to the theory I suggested that gettext() is > failing to return UTF8 on Windows. That could be a red herring, since > it's possible the encoding got changed when you copied the text into > your mail message, but the theory seems to explain the observed facts > so far. > > What locale settings are you using --- particularly lc_ctype and > lc_messages? > > regards, tom lane > >