Object types and ResultSets (java.sql.Struct)

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Object types and ResultSets (java.sql.Struct)
Date: 2010-01-23 16:39:46
Message-ID: hjf8o6$m49$1@ger.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hi,

I noticed that "object types" are not treated in a consistent manner

Taking the following table:

CREATE TYPE person_type AS
(
first_name VARCHAR(20),
last_name VARCHAR(25)
)

CREATE TABLE contacts
(
id integer,
contact person_type
)

DatabaseMetaData.getColumns() will return a java.sql.Types.STRUCT for the column "contact".
That seems to be correct to me - at least this is what I expected ;)

When running a "SELECT * FROM contacts", ResultSetMetaData.getColumnType() will return java.sql.Types.OTHER (for the contact column)

This seems to be inconsistent to me.

My expectation was that ResultSetMetaData.getColumnType() should also return java.sql.Types.STRUCT and that the object returned by getObject() on the ResultSet should implement java.sql.Struct (which it doesn't)

Regards
Thomas

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Juergen Weber 2010-01-27 18:38:03 Add XATMI C API
Previous Message Kris Jurka 2010-01-23 00:04:01 Re: How to use JDBC to update LargeObject