Re: Array support

From: Kris Jurka <books(at)ejurka(dot)com>
To: Thomas O'Dowd <tom(at)uwillsee(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Array support
Date: 2005-04-28 14:26:52
Message-ID: Pine.BSO.4.56.0504280921150.30994@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Thu, 28 Apr 2005, Thomas O'Dowd wrote:

> 1. I tried to use the syntax ARRAY['one'] in the string returned by
> toString(). This fails with the server error:
>
> array value must start with "{" or dimension information
>
> So it looks like that format is not supported by server side prepared
> statements.

Right, the ARRAY[] syntax is part of the parser which doesn't get invoked
on parameters, so you need to use the {} format.

> 2. How do you set an array to null? I tried:
> PreparedStatement.setNull(index, java.sql.Types.ARRAY);
> but it throws the exception
>
> org.postgresql.util.PSQLException: Unknown Types value.
> at org.postgresql.jdbc2.AbstractJdbc2Statement.setNull(AbstractJdbc2Statement.java:1003)
>
> Q: How do I set an array column to null using a PreparedStatement?

This is indeed a bug, I've fixed this in the 8.0 + head branches. Updated
jar files are available here:

http://www.ejurka.com/pgsql/jars/tod/

Kris Jurka

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2005-04-28 14:58:13 Re: _pg_keyposition is gone in HEAD
Previous Message Kris Jurka 2005-04-28 14:21:06 Re: Statement Timeout and Locking