X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E31A7D6F8C for ; Tue, 23 Aug 2005 11:34:32 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 37800-10 for ; Tue, 23 Aug 2005 14:34:29 +0000 (GMT) Received: from mail63.csoft.net (leary3.csoft.net [63.111.22.74]) by svr1.postgresql.org (Postfix) with SMTP id 97345D6F6F for ; Tue, 23 Aug 2005 11:34:27 -0300 (ADT) Received: (qmail 30181 invoked by uid 1112); 23 Aug 2005 14:34:31 -0000 Date: Tue, 23 Aug 2005 09:34:31 -0500 (EST) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: Joost Kraaijeveld Cc: pgsql-jdbc@postgresql.org Subject: Re: Is this error correct/possible? In-Reply-To: <1124790915.27046.25.camel@panoramix.askesis.nl> Message-ID: References: <1124790915.27046.25.camel@panoramix.askesis.nl> MIME-Version: 1.0 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.008 required=5 tests=[AWL=0.008] X-Spam-Level: Content-Type: TEXT/PLAIN; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE X-Archive-Number: 200508/172 X-Sequence-Number: 13741 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-1086122986-1124807671=:32740 Content-Type: TEXT/PLAIN; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Tue, 23 Aug 2005, Joost Kraaijeveld wrote: > I have a database which is created in PostgreSQL 8.0.3 which is filled > with a PostgreSQL 7.4.7 database backup. Both databases where created > with SQL_ASCII. > > "Invalid character data was found. This is most likely caused by stored > data containing characters that are invalid for the character set the > database was created in. The most common example of this is storing > 8bit data in a SQL_ASCII database." > > Inspection of the row (using pgadmin3) shows that there is the char "=FC" > in a char(40) columns. > > Questions: > > 1. Is a "=FC" allowed in a SQL_ASCII database and a column of char(40)? It is allowed to be stored in the database because SQL_ASCII is not a real= =20 encoding. SQL_ASCII allows you to store anything you want and doesn't=20 require you to tell the server what character set it actually is. The=20 problem is on the return end, the JDBC driver asks the server to always=20 return data in UTF-8 by setting the client_encoding appropriately. The=20 server has no idea what the original encoding of the data was, so it has=20 no means of converting it to unicode. It may happen to look like=20 u-double-dot in your particular pgadmin3 client's encoding, but if that=20 client's encoding was different it would show up as a different character.= =20 This is why the JDBC driver bails out instead of just picking a=20 random character. > 2. If so, is this a JDBC bug? No. The JDBC documentation clearly states not to choose a SQL_ASCII=20 database for your data. http://jdbc.postgresql.org/documentation/80/your-database.html > 3. If not, is this a PostgreSQL bug, allowing a non-allowed character in > a column? > This is how the SQL_ASCII encoding works, for better or worse (mostly=20 worse). The problem is that you've likely had two different clients=20 connect with different client_encodings which ends up storing two=20 different encodings in the database which is then going to break the other= =20 client when it tries to display it. Kris Jurka --0-1086122986-1124807671=:32740--