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

Re: ResultSetMetaData.getColumnDisplaySize returns 2147483647 ?

From: Kris Jurka <books(at)ejurka(dot)com>
To: DGPickett <DGPickett(at)aol(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: ResultSetMetaData.getColumnDisplaySize returns 2147483647 ?
Date: 2009-02-26 18:18:55
Message-ID: Pine.BSO.4.64.0902261310090.24291@leary.csoft.net (view raw or flat)
Thread:
Lists: pgsql-jdbc

On Thu, 26 Feb 2009, DGPickett wrote:

> I feel it runs contrary to the purpose of JDBC to make clients have
> postgres-specific code for this response.  The common JDBC
> speccification does not support returning int max (or anything else)
> for "I don't know."

Exactly.  Since the spec doesn't say what to do, what do you want the JDBC 
driver to do?  Throw an exception?  That's not helpful at all.  The JDBC 
team has come up with a solution that works for most clients.  If you have 
a concrete suggestion as to how this case should be handled that will work 
for everyone, then we'd be glad to hear it.  Just wishing this case didn't 
exist isn't helpful.

> It seems unreasonable that this implementation cannot deal with these
> trivial cases.  I am not sure whether the fault lies with the JDBC
> implementation or the underlying RDBMS server, that we cannot
> determine that "X" is 1 byte wide...

The server is responsible for determining the type and length of data, not 
the JDBC driver.  The server tells the JDBC driver that it is unknown and 
the driver has to do something with it.  You are still ignoring the fact 
that there must be cases where the server cannot possibly know the length 
of a piece of data even if it was capable of of handling the simpler 
cases.

Kris Jurka

In response to

Responses

pgsql-jdbc by date

Next:From: DGPickettDate: 2009-02-26 19:53:10
Subject: Re: ResultSetMetaData.getColumnDisplaySize returns 2147483647 ?
Previous:From: DGPickettDate: 2009-02-26 16:54:11
Subject: Re: ResultSetMetaData.getColumnDisplaySize returns 2147483647 ?

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