Re: Using java.lang.Character for "char" data type - Mailing list pgsql-jdbc

From Lew
Subject Re: Using java.lang.Character for "char" data type
Date
Msg-id ht8thg$q6a$1@news.albasani.net
Whole thread Raw
In response to Re: Using java.lang.Character for "char" data type  (Craig Ringer <craig@postnewspapers.com.au>)
List 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

pgsql-jdbc by date:

Previous
From: Lew
Date:
Subject: Re: After server restart I get - An I/O error occured while sending to the backend.
Next
From: Lew
Date:
Subject: Re: Using java.lang.Character for "char" data type