Re: Fix setArray() when using the v3 protocol (was Re: Postgres

Поиск
Список
Период
Сортировка
От Oliver Jowett
Тема Re: Fix setArray() when using the v3 protocol (was Re: Postgres
Дата
Msg-id 416609D6.1040305@opencloud.com
обсуждение исходный текст
Ответ на Re: Fix setArray() when using the v3 protocol (was Re: Postgres 8.0 + JDBC)  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 по дате отправления:

Предыдущее
От: Oliver Jowett
Дата:
Сообщение: tightening up on use of oid 0
Следующее
От: Kris Jurka
Дата:
Сообщение: Re: tightening up on use of oid 0