pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Jowett <oliver@opencloud.com>
To: Johann Robette <jrobette@onyme.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Postgres 8.0 + JDBC
Date: Wed, 06 Oct 2004 09:10:49 +1300
Message-ID: <4162FFC9.3010808@opencloud.com> (raw)
In-Reply-To: <002901c4aaf7$feabc310$a5010a0a@Johann>
References: <002901c4aaf7$feabc310$a5010a0a@Johann>

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



view thread (6+ messages)  latest in thread

Message-ID: <4162FFC9.3010808@opencloud.com>
Permalink:  ../4162FFC9.3010808@opencloud.com/
Also on:    postgresql.org/message-id/4162FFC9.3010808@opencloud.com

 · 

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: oliver@opencloud.com, jrobette@onyme.com
  Subject: Re: Postgres 8.0 + JDBC
  In-Reply-To: <4162FFC9.3010808@opencloud.com>
  References: <002901c4aaf7$feabc310$a5010a0a@Johann> <4162FFC9.3010808@opencloud.com>

* 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