Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-jdbc by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group