From: | Kris Jurka <books(at)ejurka(dot)com> |
---|---|
To: | Marek Lewczuk <newsy(at)lewczuk(dot)com> |
Cc: | pgsql-jdbc <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | Re: ResultSetMetaData getColumnTypeName() |
Date: | 2007-11-21 23:09:49 |
Message-ID: | Pine.BSO.4.64.0711211802240.22470@leary.csoft.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
On Wed, 21 Nov 2007, Marek Lewczuk wrote:
> I would like to discuss an issue ResultSetMetaData.getColumnTypeName().
> Within current implementation of PostgreSQL JDBC getColumnTypeName()
> returns only locale name of a type, even if it is a user-defined type.
> The JDBC docs says: "...returns type name used by the database. If the
> column type is a user-defined type, then a fully-qualified type name is
> returned."
>
> It means, that any other type that is not defined within pg_catalog
> should be returned with its schema name, so e.g. type my_price in schema
> blabla should be returned as "blabla.my_price". It's quite simple to fix
> it and I'm ready to do it, but before that I would like to ask about
> your opinion about changing this behavior. I found this problem when I
> needed to translate user-defined types to Java and without schema I
> cannot be sure, that a type is the one that I want to translate (cause
> there can be many types with the same local name).
>
Currently the driver implements DatabaseMetaData.getUDTs by considering
only complex types and domains as UDTs and the javadoc for that method
seems to imply that's correct. Perhaps the JDBC spec isn't prepared for
the extensibility that pg offers, but you'll need to reconcile these two
definitions if you want to qualify all types outside pg_catalog.
Could explain in more detail how you're mapping these UDTs to Java? Using
PGobject? I'm not sure how you'd map without an implemention of
SQLData/Input/Output.
My recollection was that making all type operations in the driver schema
qualified was more work that a simple change to TypeInfoCache, but I don't
recall the details, so I'd like to see what you come up with. While you
wouldn't want to report the pg_catalog parts of base types you would need
a way to ensure that if you had myschema.int4 it wouldn't conflict.
Kris Jurka
From | Date | Subject | |
---|---|---|---|
Next Message | Eric Lenio | 2007-11-22 06:09:06 | Re: AbstractJdbc2Array - another patch |
Previous Message | Kris Jurka | 2007-11-21 22:49:28 | Re: AbstractJdbc2Array - another patch |