Re: getArray() and char[]

From: Kris Jurka <books(at)ejurka(dot)com>
To: Jeffrey Cox <namredips(at)gmail(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: getArray() and char[]
Date: 2007-02-01 17:52:45
Message-ID: Pine.BSO.4.64.0702011235140.7805@leary2.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Thu, 1 Feb 2007, Jeffrey Cox wrote:

> While looking into updating getProcedureColumns, to appropriately return
> COLUMN_TYPE, ran into a 'not implemented' exception. Seems that getArray
> is not implemented for arrays of type char. Kinda fuzzy on all this, but
> walked the code and ultimately added an entry in TypeInfoCache for
> 'char' and then updated AbstractJdbc2Array to handle 'char' as a
> java.lang.Character[] rather than java.lang.String[]

This is not quite right. The pg_proc column you are looking at is an
array of "char" which is a special one byte datatype which is different
than something like char(N) which is implemented by the bpchar type on the
backend. The new TypeInfoCache code is correct, but the
AbstractJdbc2Array must still return String[] since it must support the
char(N) version as well.

> it seems that the issue was that char[] was being identified as
> Types.OTHER in TypeInfoCache. Which fixed the unimplemented error.
> However, considering char[] as a String caused getArray() to return a
> string containing leading and trailing curly brackets. Hence the change
> to AbstractJdbc2Array.
>

I'm not sure why that would happen, perhaps it indicates another bug?
I cannot duplicate it here with the attached test case and your
TypeInfoCache changes.

Kris Jurka

Attachment Content-Type Size
ArrayTest.java text/plain 561 bytes

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2007-02-01 18:26:45 Re: Synthesize support for Statement.getGeneratedKeys()?
Previous Message Kris Jurka 2007-02-01 17:33:39 Re: jdbc connection problem