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

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Fix setArray() when using the v3 protocol (was Re: Postgres
Date: 2004-10-08 03:30:30
Message-ID: 416609D6.1040305@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-jdbc

Tom Lane wrote:
> Oliver Jowett <oliver(at)opencloud(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dennis Gearon 2004-10-08 04:08:18 Re: flattened tables with normalized tables
Previous Message Tom Lane 2004-10-08 03:04:41 Re: Fix setArray() when using the v3 protocol (was Re: Postgres 8.0 + JDBC)

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2004-10-08 03:32:38 tightening up on use of oid 0
Previous Message Tom Lane 2004-10-08 03:04:41 Re: Fix setArray() when using the v3 protocol (was Re: Postgres 8.0 + JDBC)