Re: ResultSetMetaData.getColumnDisplaySize returns 2147483647 ?

Поиск
Список
Период
Сортировка
От Kris Jurka
Тема Re: ResultSetMetaData.getColumnDisplaySize returns 2147483647 ?
Дата
Msg-id Pine.BSO.4.64.0902251858180.2899@leary.csoft.net
обсуждение исходный текст
Ответ на ResultSetMetaData.getColumnDisplaySize returns 2147483647 ?  (DGPickett <DGPickett@aol.com>)
Список pgsql-jdbc

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

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Jesus Maudes
Дата:
Сообщение: Early JDBC driver load?
Следующее
От: DGPickett
Дата:
Сообщение: Re: ResultSetMetaData.getColumnDisplaySize returns 2147483647 ?