Re: Max size for bytea type

From: Kris Jurka <books(at)ejurka(dot)com>
To: "Do, Leon \(Leon\)" <leondo(at)alcatel-lucent(dot)com>
Cc: PostgreSQL JDBC <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Max size for bytea type
Date: 2007-02-18 23:40:53
Message-ID: Pine.BSO.4.64.0702181834270.21234@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Thu, 1 Feb 2007, Kris Jurka wrote:

> On Mon, 22 Jan 2007, Do, Leon (Leon) wrote:
>
>> Sorry, it is my mistake. It is wrong data type.
>>
>
> Still there is a TODO item here. The driver shouldn't bail out with an
> ArrayIndexOutOfBoundsException. It might be best to fail immediately for a
> getBytes call on something that isn't bytea data. It's conceivable that you
> there is bytea escaped data in a text field, but really, what are the odds
> (and use cases) of that?
>

Checking the code behind this, I see:

AbstractJdbc2ResultSet.java:2150

if (fields[columnIndex - 1].getOID() == Oid.BYTEA)
{
return trimBytes(columnIndex,PGbytea.toBytes(this_row[columnIndex - 1]));
}
else
{
return trimBytes(columnIndex, this_row[columnIndex - 1]);
}

So the check I suggested already exists and I don't understand how you got
this error. Do you still have your test case handy?

Kris Jurka

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2007-02-19 00:20:20 Re: Memory leaks using refcursors
Previous Message Mark De Souza 2007-02-18 06:12:37 ResultSetMetaData performance