Skip site navigation (1) Skip section navigation (2)

Re: Postgres 8.0 + JDBC

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Johann Robette <jrobette(at)onyme(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Postgres 8.0 + JDBC
Date: 2004-10-05 20:10:49
Message-ID: 4162FFC9.3010808@opencloud.com (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-jdbc
Johann Robette wrote:

>                 java.sql.SQLException: ERROR: cannot cast type text to 
> text[]

setArray has never worked particularly well; you're seeing another 
manifestation here.

The underlying problem here is that:

- setArray() is claiming that the type it is setting is a VARCHAR
- the parameter is being passed as a typed parameter via the V3 
protocol, with type = 'text'
- apparently you can't cast directly from text -> text[] (although you 
can interpret an untyped literal as text[], which is why it worked before).

It seems possible to fix the driver to handle this case by making 
setArray() derive a proper array type name i.e. ("_" + 
Array.getBaseType()), and using that rather than 'text' as the parameter 
type.

I'll try to do this soon, but I'm a bit busy so it may be a few days.

A longer term fix is to properly implement array support in setArray().. 
I've submitted patches in the past to do this but they've never made it 
into the official driver.

-O

In response to

Responses

pgsql-jdbc by date

Next:From: Kris JurkaDate: 2004-10-05 20:31:39
Subject: Re: Postgres 8.0 + JDBC
Previous:From: Johann RobetteDate: 2004-10-05 16:25:52
Subject: Postgres 8.0 + JDBC

pgsql-general by date

Next:From: Mike MorrisDate: 2004-10-05 20:15:39
Subject: SSL connection between PHP4 & PostgreSQL ???
Previous:From: Frank MilesDate: 2004-10-05 18:57:56
Subject: Re: Verifying Referential Integrity

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group