I am using postgres 7.4 with an 8.1 JDBC driver. I am considering
whether I should use postgres arrays, and a key issue is JDBC support.
I found this comment about the 7.4 driver from Oliver Jowett
(http://archives.postgresql.org/pgsql-jdbc/2004-11/msg00141.php):
The driver does not really support setArray() / updateArray() for
arbitary Array implementations. I had a patch to fix this ages ago but
it has rotted since then, and was never really the right way to do it
anyway.
The 8.1 release notes for dev307 say this, which seems to imply
better support:
Fix setArray when using the v3 protocol. We can't bind arrays as text,
we need the correct type. This gets the array type from the
Array.getBaseType method. This is a fragile means that depends on a
specific Array implementation, but we already depend on a very
specific implementation (toString() returning a correctly formatted pg
array) that we can live with this. (oliver)
I'm not sure I understand this. It sounds like the array is converted
to a string. Is the string then just pasted into the query? What does
this to to the use of server-side prepared statements? I'd like to
avoid parsing the "same" statement repeatedly due to the use of
arrays.
Or is the string then somehow used to bind an array to the prepared
statement?
I don't have to use postgres array, and if the driver will introduce
lots of string manipulation, I'll probably do something else.
Jack Orenstein