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