pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Віталій Тимчишин <tivv00@gmail.com>
To: pgsql-jdbc@postgresql.org
Subject: Re: ResultSetMetaData.getColumnDisplaySize returns 2147483647 ?
Date: Tue, 3 Mar 2009 15:57:17 +0200
Message-ID: <331e40660903030557l732b7976nebdf5e88d0eb32f1@mail.gmail.com> (raw)
In-Reply-To: <5689f05b-134f-4510-af43-6fe763dfceb4@y13g2000yqn.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>
	<49ABA286.7000707@opencloud.com>
	<5689f05b-134f-4510-af43-6fe763dfceb4@y13g2000yqn.googlegroups.com>

2009/3/2 DGPickett <DGPickett@aol.com>

> On Mar 2, 4:10 am, oli...@opencloud.com (Oliver Jowett) wrote:
> > 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 ..
>
> If you have to change calling code to access Postgres, it violates the
> original promise of JDBC: use me and be portable.  If you want an 'I
> don't know' response built into this API method, sell it to the JDBC
> community, but until then, it is a requirement.  Most RDBMS have not
> stumbled when delivering on the requirement, so selling it as a
> hardship seems difficult.  As the real estate zoning lawyers say,
> "This is, at best, a self-imposed hardship."
>

I'd say it works fairly well here. It is asked a maximum, it don't know - so
it tells theoretical maximum possible and that is not precise, but correct
value. And the jisql does have a bug - it tries to allocate memory equal to
column maximum width. Imagine a varchar(1000000000) column I may use to
store long descriptions without limits (or equal PostgreSQL "text" type). My
values never larger then, say, 4KB, and jisql would try to allocate
1000000000 size buffer, that is stupid and would lead to problems. It should
have some maximum limit (say, 1MB), because even for varchar(many) column,
it usually do not have such a long values.

view thread (13+ messages)

Message-ID: <331e40660903030557l732b7976nebdf5e88d0eb32f1@mail.gmail.com>
Permalink:  ../331e40660903030557l732b7976nebdf5e88d0eb32f1@mail.gmail.com/
Also on:    postgresql.org/message-id/331e40660903030557l732b7976nebdf5e88d0eb32f1@mail.gmail.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: tivv00@gmail.com
  Subject: Re: ResultSetMetaData.getColumnDisplaySize returns 2147483647 ?
  In-Reply-To: <331e40660903030557l732b7976nebdf5e88d0eb32f1@mail.gmail.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> <5689f05b-134f-4510-af43-6fe763dfceb4@y13g2000yqn.googlegroups.com> <331e40660903030557l732b7976nebdf5e88d0eb32f1@mail.gmail.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