Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 4D759634C06 for ; Thu, 27 May 2010 16:29:16 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 35617-02-2 for ; Thu, 27 May 2010 19:29:08 +0000 (UTC) Received: from news.hub.org (news.hub.org [200.46.204.72]) by mail.postgresql.org (Postfix) with ESMTP id B2BD6634344 for ; Thu, 27 May 2010 16:29:00 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.14.3/8.14.3) with ESMTP id o4RJSlK2031458 for ; Thu, 27 May 2010 16:28:57 -0300 (ADT) (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.14.3/8.14.3/Submit) id o4MFY85b016697 for pgsql-jdbc@postgresql.org; Sat, 22 May 2010 12:34:08 -0300 (ADT) (envelope-from news) From: Lew X-Newsgroups: pgsql.interfaces.jdbc Subject: Re: Using java.lang.Character for "char" data type Date: Sat, 22 May 2010 11:34:24 -0400 Organization: albasani.net Lines: 19 Message-ID: References: <4BF7A718.50607@postnewspapers.com.au> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@albasani.net X-User-ID: LQbhc1RIejVX7J4RHvbxlHZLMRKCt7PJXIq83k+onzY= In-Reply-To: <4BF7A718.50607@postnewspapers.com.au> Cancel-Lock: sha1:45FYBa2UGYokeO/82T81kXLfl/Y= User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100423 Thunderbird/3.0.4 X-NNTP-Posting-Host: G669Ys94TzgqVzW8NRisOUywRgiJ3D5wG+ZYjBMa3tg= To: pgsql-jdbc@postgresql.org X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.011 tagged_above=-10 required=5 tests=BAYES_40=-0.001, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201005/79 X-Sequence-Number: 20563 Kris Jurka wrote: >> It would be possible to support setObject for a Character, but be aware >> that "char" is not a character long, it's a byte long, so it will fail >> on multibyte characters. Craig Ringer wrote: > So really the appropriate SQL type for Java 'Character' is varchar(1) ? > And a PostgreSQL 'char' (bpchar, not character(1)) maps best to a Java > 'Byte' ? Not according to the PG documentation. According to that, SQL type "CHAR" should be just fine for a Java 'char'. Mostly. (I worry about code points that take more than 2 bytes.) I would not use "VARCHAR" to represent a Java 'char'. -- Lew