Re: Array support - Mailing list pgsql-jdbc

From Kris Jurka
Subject Re: Array support
Date
Msg-id Pine.BSO.4.56.0504280921150.30994@leary.csoft.net
Whole thread Raw
In response to Re: Array support  (Thomas O'Dowd <tom@uwillsee.com>)
Responses Re: Array support
List 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

pgsql-jdbc by date:

Previous
From: Kris Jurka
Date:
Subject: Re: Statement Timeout and Locking
Next
From: Kris Jurka
Date:
Subject: Re: _pg_keyposition is gone in HEAD