Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 3019D63339A for ; Wed, 25 Feb 2009 20:12:14 -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 21191-01 for ; Wed, 25 Feb 2009 20:12:07 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from leary.csoft.net (leary.csoft.net [205.205.214.5]) by mail.postgresql.org (Postfix) with ESMTP id 49AB9632BF7 for ; Wed, 25 Feb 2009 20:11:52 -0400 (AST) Received: by leary.csoft.net (Postfix, from userid 1112) id 62B69ACA8; Wed, 25 Feb 2009 19:11:50 -0500 (EST) Date: Wed, 25 Feb 2009 19:11:50 -0500 (EST) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: DGPickett cc: pgsql-jdbc@postgresql.org, David.Pickett@nasdaqomx.com Subject: Re: ResultSetMetaData.getColumnDisplaySize returns 2147483647 ? In-Reply-To: <095cddc9-bca7-41a5-84a8-0faca7adadc2@f11g2000vbf.googlegroups.com> Message-ID: References: <095cddc9-bca7-41a5-84a8-0faca7adadc2@f11g2000vbf.googlegroups.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200902/47 X-Sequence-Number: 19322 On Wed, 25 Feb 2009, DGPickett wrote: > Selecting a constant string or concatenated columns from postgres > using jisql (xigole), I get heap overflow. > > select 'X' AS XXX from . . . . While in this case it's obvious that 'X' has length 1, the server isn't telling the driver that. Even if it did in this case, there are clearly cases the server cannot know the output length. Consider: SELECT repeat('X', (random() * 100)::int); So regardless of the simple case you've shown, we must be able to handle unknown length data. Previously we did that by returning -1 which broke the rowset implementation which insisted that the value by >= 0. So we moved to Integer.MAX_VALUE which seems to mostly work for people. This thread details how we intend to solve the similar problem of getPrecision for Crystal Reports users, so we could likely apply the same sort of changes for display size as well. http://archives.postgresql.org/pgsql-jdbc/2008-12/msg00018.php > This discussion seems to say this is a postgres JDBC bug: > > http://forums.hotjoe.com/posts/list/315.page > That's not how I read the discussion. The thread says that h2 does the same thing and that the author has provided a workaround to allow the user to provide a custom formatter to handle data types with problems. Kris Jurka