Re: Using java.lang.Character for "char" data type

From: Lew <noone(at)lewscanon(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Using java.lang.Character for "char" data type
Date: 2010-05-22 15:34:24
Message-ID: ht8thg$q6a$1@news.albasani.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Hernan Danielan 2010-05-22 19:03:17 Error in connector or driver with big bytea
Previous Message Lew 2010-05-22 15:32:03 Re: After server restart I get - An I/O error occured while sending to the backend.