Re: Fix setArray() when using the v3 protocol (was Re: Postgres - Mailing list pgsql-jdbc

From Oliver Jowett
Subject Re: Fix setArray() when using the v3 protocol (was Re: Postgres
Date
Msg-id 416609D6.1040305@opencloud.com
Whole thread Raw
In response to Re: Fix setArray() when using the v3 protocol (was Re: Postgres 8.0 + JDBC)  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-jdbc
Tom Lane wrote:
> Oliver Jowett <oliver@opencloud.com> writes:
>
>>!         // Use a typename that is "_" plus the base type; this matches how the
>>!         // backend looks for array types.
>>!         String typename = "_" + x.getBaseTypeName();
>>!         int oid = connection.getPGType(typename);
>>!         if (oid == Oid.INVALID)
>>!             throw new PSQLException("postgresql.prep.typenotfound", PSQLState.INVALID_PARAMETER_TYPE, typename);
>
>
> Er, what about schema-qualified type names?

We don't really support those anywhere else in the driver yet.
getPGType() certainly doesn't know how to handle them.

> Also, are you sure that
> getBaseTypeName will return the correct internal type name, eg "int8"
> not "bigint"?

It'll be correct for Array implementations generated by the driver. I
didn't see an easy way to get at the list of type aliases -- they appear
to only exist in the backend's query parser. A type alias view or
something similar would be nice to have..

If you're using your own Array implementation, you're playing with fire
anyway, as the current setArray() implementation is limited and fragile.
This patch is really just to get things back to the same level of
support as before the V3 protocol rewrite, not to fix all the other
problems.

-O

pgsql-jdbc by date:

Previous
From: Oliver Jowett
Date:
Subject: tightening up on use of oid 0
Next
From: Kris Jurka
Date:
Subject: Re: tightening up on use of oid 0