X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 86CB652897 for ; Thu, 26 May 2005 05:45:44 -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 67142-06 for ; Thu, 26 May 2005 08:45:19 +0000 (GMT) Received: from vsmtp3.tin.it (vsmtp3alice.tin.it [212.216.176.143]) by svr1.postgresql.org (Postfix) with ESMTP id 1EA805280B for ; Thu, 26 May 2005 05:45:18 -0300 (ADT) Received: from casa (80.117.81.220) by vsmtp3.tin.it (7.0.027) (authenticated as giuseppe.sacco17@tin.it) id 42920E8000152C38 for pgsql-jdbc@postgresql.org; Thu, 26 May 2005 10:45:18 +0200 Received: from 62-101-126-238.fastres.net ([62.101.126.238] helo=[41.27.159.107]) by casa with esmtpsa (TLS-1.0:RSA_ARCFOUR_MD5:16) (Exim 4.50) id 1DbDzW-0002cB-4f for pgsql-jdbc@postgresql.org; Thu, 26 May 2005 10:45:22 +0200 Subject: Re: DatabaseMetaData.getExtraNameCharacters From: Giuseppe Sacco To: pgsql-jdbc@postgresql.org In-Reply-To: References: <1117034023.27493.10.camel@localhost> <1117044622.27459.28.camel@localhost> <1117047088.27493.36.camel@localhost> Content-Type: text/plain Organization: Giuseppe Sacco Consulting Date: Thu, 26 May 2005 10:43:51 +0200 Message-Id: <1117097031.3667.27.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.0.4 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.842 tagged_above=0 required=5 tests=FORGED_RCVD_HELO, RCVD_IN_NJABL_DUL, RCVD_IN_SORBS_DUL X-Spam-Level: * X-Archive-Number: 200505/114 X-Sequence-Number: 12945 Il giorno mer, 25-05-2005 alle 14:59 -0500, Kris Jurka ha scritto: [...] > You are assuming that each character is only one byte. The backend lexing > rules are a byte by byte operation, but the JDBC side is returning a > String of characters. Consider the character "Latin Small Letter s with > Acute" (\u015B) gets encoded in UTF-8 as C5 9B or \305\233 in octal. This > is one character in the result of getExtraNameCharacters. Thank you very much for your reply. Yes, I assumed that this was a one-byte character encoding and I didn't know that \200 < \305\233 < \377. I was also assuming (maybe wrongly) that JDBC driver convert java utf-8 characters to ASCII when connecting to postgresql backend. This is why I counted 191 characters. I also made a test: "CREATE TABLE A\u015B ( A VARCHAR(30) )" fails when calling java.sql.Statement.execute(). The error is: ERROR: syntax error at or near "[" Looking at the postgresql log, I found the statement was translated in "CREATE TABLE A[ ( A VARCHAR(30))" Similarly, "CREATE TABLE A\u00C0 ( A VARCHAR(30) )" succeeds. so maybe postgresql doesn't accept a broad range of utf-8 characters, while it might accept the ASCII characters from \200 to \377 when it is a Character.isLetterOrDigit(). May it be something dependant on the database encoding? Thanks again, Giuseppe