Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id D6AF3633788 for ; Tue, 3 Mar 2009 09:57:25 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 08189-07 for ; Tue, 3 Mar 2009 09:57:21 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.240]) by mail.postgresql.org (Postfix) with ESMTP id B1A176334D6 for ; Tue, 3 Mar 2009 09:57:19 -0400 (AST) Received: by an-out-0708.google.com with SMTP id c3so1547848ana.28 for ; Tue, 03 Mar 2009 05:57:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=KqCf2esxuKCl1mf0VMd41/Fk2GiSYBYom2bfDlvIR5s=; b=gvR8dOSSE2AGxFQS/f/z5DSYPs7CgITFns9ac0kOGiseuC+9rsuGOzDRlVgIp1EqDH zsmHy4i8GLdq75STpdt/gWu1opkcK3dy8GEsZCp0KmFaDbzz4sGSM53lFhG9iFc5VVOe in02CWVoq37/typmy7KiPrgxVEEW4epUVyneE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=OqKBcMNP6uQI62e3ZQcFCUqXhlPFc0+SGbbIHtAV4W71TJ+RZWBahK1TxODt0ZoXqL 4zRaMa0mDschXOTPMtm3NM8eE4rdvsCZrbiicMYUcXzlhtAWkVfjA5d3R2mNPo/U0IMM r1df3l3mlD18uVhO29/ABK4kfnW0CtB1J/XFs= MIME-Version: 1.0 Received: by 10.231.18.130 with SMTP id w2mr3636816iba.11.1236088637527; Tue, 03 Mar 2009 05:57:17 -0800 (PST) In-Reply-To: <5689f05b-134f-4510-af43-6fe763dfceb4@y13g2000yqn.googlegroups.com> References: <095cddc9-bca7-41a5-84a8-0faca7adadc2@f11g2000vbf.googlegroups.com> <3c7f373b-77e6-4860-984e-101af492abe3@f37g2000vbf.googlegroups.com> <8b19844a-98d4-4967-9426-3ddeec6f8559@a39g2000yqc.googlegroups.com> <49ABA286.7000707@opencloud.com> <5689f05b-134f-4510-af43-6fe763dfceb4@y13g2000yqn.googlegroups.com> Date: Tue, 3 Mar 2009 15:57:17 +0200 Message-ID: <331e40660903030557l732b7976nebdf5e88d0eb32f1@mail.gmail.com> Subject: Re: ResultSetMetaData.getColumnDisplaySize returns 2147483647 ? From: =?KOI8-U?B?96bUwcymyiD0yc3eydvJzg==?= To: pgsql-jdbc@postgresql.org Content-Type: multipart/alternative; boundary=00221504700f26968f04643750fa X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200903/8 X-Sequence-Number: 19338 --00221504700f26968f04643750fa Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 2009/3/2 DGPickett > 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. --00221504700f26968f04643750fa Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

2009/3/2 DGPickett <= ;DGPickett@aol.com>
<= blockquote class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, 2= 04, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Mar 2, 4:10=A0am, 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 th= e
original promise of JDBC: use me and be portable. =A0If you want an 'I<= br> don't know' response built into this API method, sell it to the JDB= C
community, but until then, it is a requirement. =A0Most RDBMS have not
stumbled when delivering on the requirement, so selling it as a
hardship seems difficult. =A0As 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(1= 000000000) column I may use to store long descriptions without limits (or e= qual PostgreSQL "text" type). My values never larger then, say, 4= KB, 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), b= ecause even for varchar(many) column, it usually do not have such a long va= lues. --00221504700f26968f04643750fa--