pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Jowett <oliver@opencloud.com>
To: DGPickett <DGPickett@aol.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: ResultSetMetaData.getColumnDisplaySize returns 2147483647 ?
Date: Mon, 02 Mar 2009 22:10:30 +1300
Message-ID: <49ABA286.7000707@opencloud.com> (raw)
In-Reply-To: <8b19844a-98d4-4967-9426-3ddeec6f8559@a39g2000yqc.googlegroups.com>
References: <095cddc9-bca7-41a5-84a8-0faca7adadc2@f11g2000vbf.googlegroups.com>
	<Pine.BSO.4.64.0902251858180.2899@leary.csoft.net>
	<be6ffbdc-6190-4f2b-8e2e-b45fa9e5a596@r27g2000vbp.googlegroups.com>
	<Pine.BSO.4.64.0902261310090.24291@leary.csoft.net>
	<3c7f373b-77e6-4860-984e-101af492abe3@f37g2000vbf.googlegroups.com>
	<Pine.BSO.4.64.0902261553090.26397@leary.csoft.net>
	<8b19844a-98d4-4967-9426-3ddeec6f8559@a39g2000yqc.googlegroups.com>

DGPickett wrote:

> Yes, I see it comes up over and over:
> 
> http://archives.postgresql.org/pgsql-hackers/2007-06/msg00428.php
> 
> The discussions about char versus byte were nice, but the method name
> says "Display" and the api doc says "characters", so if you have
> Nvarchar(20) in a 16 bit unicode context, the storage needs 40 bytes
> (plus a length) and the right return is 20.  Nobody expects or wants
> the gratuitous expense of dynamic sizing, just the obvious max so they
> can typeset text output.  JAVA hides the code for wide characters, and
> we do not want it bring it back into the light.

Except that the backend is not written in Java, and neither are all the
other frontends.

To some extent, this is a case of the JDBC interface not being flexible
enough about the metadata (or often not even documenting what it's meant
to mean!) - so we are stuck trying to provide the best fit we can from
the data the server gives us.

Asking the server to conform to JDBC's particular idea of how the
metadata should look, at the expense of other interfaces, seems a bit
unreasonable.

If you have a better idea about how the JDBC driver can map the
information coming from the backend to the JDBC metadata interfaces, a
patch would be great. Or you could change the calling code to
bounds-check the metadata results before it goes off and tries to
allocate the entire heap for one column in one row ..

-O



view thread (13+ messages)  latest in thread

Message-ID: <49ABA286.7000707@opencloud.com>
Permalink:  ../49ABA286.7000707@opencloud.com/
Also on:    postgresql.org/message-id/49ABA286.7000707@opencloud.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: oliver@opencloud.com, DGPickett@aol.com
  Subject: Re: ResultSetMetaData.getColumnDisplaySize returns 2147483647 ?
  In-Reply-To: <49ABA286.7000707@opencloud.com>
  References: <095cddc9-bca7-41a5-84a8-0faca7adadc2@f11g2000vbf.googlegroups.com> <Pine.BSO.4.64.0902251858180.2899@leary.csoft.net> <be6ffbdc-6190-4f2b-8e2e-b45fa9e5a596@r27g2000vbp.googlegroups.com> <Pine.BSO.4.64.0902261310090.24291@leary.csoft.net> <3c7f373b-77e6-4860-984e-101af492abe3@f37g2000vbf.googlegroups.com> <Pine.BSO.4.64.0902261553090.26397@leary.csoft.net> <8b19844a-98d4-4967-9426-3ddeec6f8559@a39g2000yqc.googlegroups.com> <49ABA286.7000707@opencloud.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