pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Lew <noone@lewscanon.com>
To: pgsql-jdbc@postgresql.org
Subject: Re: Using java.lang.Character for "char" data type
Date: Sat, 22 May 2010 11:34:24 -0400
Message-ID: <ht8thg$q6a$1@news.albasani.net> (raw)
In-Reply-To: <4BF7A718.50607@postnewspapers.com.au>
References: <AANLkTinKef9bhdEhYMMzxiRLKUXtGt_cUOnIPT5sibXI@mail.gmail.com>
	<alpine.BSO.2.00.1005211813180.22460@leary.csoft.net>
	<4BF7A718.50607@postnewspapers.com.au>

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



view thread (8+ messages)  latest in thread

Message-ID: <ht8thg$q6a$1@news.albasani.net>
Permalink:  ../ht8thg$q6a$1@news.albasani.net/
Also on:    postgresql.org/message-id/ht8thg$q6a$1@news.albasani.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: noone@lewscanon.com
  Subject: Re: Using java.lang.Character for "char" data type
  In-Reply-To: <ht8thg$q6a$1@news.albasani.net>
  References: <AANLkTinKef9bhdEhYMMzxiRLKUXtGt_cUOnIPT5sibXI@mail.gmail.com> <alpine.BSO.2.00.1005211813180.22460@leary.csoft.net> <4BF7A718.50607@postnewspapers.com.au> <ht8thg$q6a$1@news.albasani.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox