From: Kris Jurka <books@ejurka.com>
To: Thomas O'Dowd <tom@uwillsee.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Array support
Date: Thu, 28 Apr 2005 09:26:52 -0500 (EST)
Message-ID: <Pine.BSO.4.56.0504280921150.30994@leary.csoft.net> (raw)
In-Reply-To: <1114680320.8404.88.camel@localhost.localdomain>
References: <1114094185.26958.22.camel@localhost.localdomain>
<Pine.BSO.4.56.0504211333040.5816@leary.csoft.net>
<42681D28.6060408@opencloud.com>
<1114680320.8404.88.camel@localhost.localdomain>
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
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: books@ejurka.com, tom@uwillsee.com
Subject: Re: Array support
In-Reply-To: <Pine.BSO.4.56.0504280921150.30994@leary.csoft.net>
References: <1114094185.26958.22.camel@localhost.localdomain> <Pine.BSO.4.56.0504211333040.5816@leary.csoft.net> <42681D28.6060408@opencloud.com> <1114680320.8404.88.camel@localhost.localdomain> <Pine.BSO.4.56.0504280921150.30994@leary.csoft.net>
* 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