pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dan Evans <devans@invores.com>
To: pgsql-jdbc@postgresql.org
Subject: Re: getColumnDisplayWidth() returns 0x7fffffff for char varying
Date: Mon, 08 Jun 2009 10:41:05 -0400
Message-ID: <4A2D2301.60703@invores.com> (raw)
In-Reply-To: <4A2C44E6.4040401@opencloud.com>
References: <4A2AB526.1040907@invores.com>
	<4A2C44E6.4040401@opencloud.com>

Oliver Jowett wrote:
> Dan Evans wrote:
> 
>> My problem is that getColumnDisplayWidth() returns the widths
>>
>> column(1) uname(2147483647)
> 
> This has been discussed at some length previously, check the list archives.
> 
> (quick summary from memory: for an unbounded character varying type,
> there's nothing really sensible we can return - that column could have a
> gigabyte of text for all we know. We originally returned -1 but that
> broke some common RowSet implementations. Now we return Integer.MAX_VALUE)
> 
> -O
> 

I did check the archives before posting, but the hits on getColumnDisplayWidth() did not seem relevant.  If you can point to the approximate date, I'd appreciate it.

For any ResultSet that is completely contained in the address space of the requestor, the return value can be the maximum length of the values for the requested column in the result set.  If the ResultSet is not complete in the requestor's address space at the time of the getColumnDisplayWidth() call, that might be the time to return Integer.MAX_VALUE signifying no useful information.  Most ResultSet's are reasonably small, so I would hope that doesn't happen often.  But even then, some useful information can be provided to the caller.  The maximum length across the received rows can be returned, with a negative value indicating that this is only an estimate based on the received rows. However, if negative values break some implementations, then that is precluded.

Dan



view thread (6+ messages)

Message-ID: <4A2D2301.60703@invores.com>
Permalink:  ../4A2D2301.60703@invores.com/
Also on:    postgresql.org/message-id/4A2D2301.60703@invores.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: devans@invores.com
  Subject: Re: getColumnDisplayWidth() returns 0x7fffffff for char varying
  In-Reply-To: <4A2D2301.60703@invores.com>
  References: <4A2AB526.1040907@invores.com> <4A2C44E6.4040401@opencloud.com> <4A2D2301.60703@invores.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox