Re: Retrieving bytea column problem - they're are sometimes truncated

From: "Mike Cannon-Brookes" <mike(at)atlassian(dot)com>
To: "Barry Lind" <barry(at)xythos(dot)com>
Cc: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Retrieving bytea column problem - they're are sometimes truncated
Date: 2001-11-19 05:22:33
Message-ID: NCBBKLKCHGCKLBAFEDFDKECPKMAA.mike@atlassian.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Any ideas on this? Do I need to install 7.2 beta to use bytea columns? (I'm
doubtful that would make a difference in this case).

Can someone more knowledgeable about the driver internals point me to where
I can start to debug inside QueryExectutor / pg_stream?

-mike

Mike Cannon-Brookes :: mike(at)atlassian(dot)com

Atlassian :: http://www.atlassian.com
Supporting YOUR J2EE World

> -----Original Message-----
> From: pgsql-jdbc-owner(at)postgresql(dot)org
> [mailto:pgsql-jdbc-owner(at)postgresql(dot)org]On Behalf Of Mike Cannon-Brookes
> Sent: Sunday, November 18, 2001 9:44 AM
> To: Barry Lind
> Cc: pgsql-jdbc(at)postgresql(dot)org
> Subject: Re: [JDBC] Retrieving bytea column problem - they're are
> sometimes truncated
>
>
> Barry,
>
> Running postgres 7.1.3 and a freshly built driver from CVS.
>
> -mike
>
>
> > -----Original Message-----
> > From: Barry Lind [mailto:barry(at)xythos(dot)com]
> > Sent: Sunday, November 18, 2001 7:46 AM
> > To: mike(at)atlassian(dot)com
> > Cc: pgsql-jdbc(at)postgresql(dot)org
> > Subject: Re: Retrieving bytea column problem - they're are sometimes
> > truncated
> >
> >
> > Mike,
> >
> > Which version of the database and drivers are you running?
> >
> > thanks,
> > --Barry
> >
> >
> > Mike Cannon-Brookes wrote:
> >
> > > G'day all,
> > >
> > > I've been hacking at this all day and have now been through my
> > source and
> > > then the driver source - grokking the entire postgres jdbc
> driver in the
> > > process ;)
> > >
> > > What happens is when I store binary content into a bytea field
> > it works fine
> > > (using setBinaryStream() or setBytes()). I've tested this by
> > looking into
> > > the DB at the actual content itself.
> > >
> > > However when I retrive the content, it's sometimes truncated.
> > (It appears to
> > > be for content greater than about 25k but that's a very rough
> > > approximation).
> > >
> > > here's a snippet of my debugging code:
> > >
> > > org.postgresql.jdbc2.ResultSet.java
> > >
> > > if (fields[columnIndex - 1].getPGType().equals("bytea"))
> > > {
> > > String s = getString(columnIndex);
> > > System.out.println("s = " + s);
> > > byte[] result = PGbytea.toBytes(s);
> > > System.out.println("result.length = " + result.length);
> > > return result;
> > > }
> > >
> > > the result.length returned (in one example) is 59402 bytes,
> > when the length
> > > of the bytea field is actually 190608 bytes.
> > >
> > > printing s to the console indeed reveals that it has been truncated.
> > >
> > > (As a test I inserted a list of a few thousand emails addresses
> > in order,
> > > starting from a-z - it gets truncated around f - although the
> > DB has all the
> > > way through to z ;))
> > >
> > > I looked deeper into the source for about 30 minutes but got a
> > little lost
> > > in pg_stream in QueryExecutor and figured I'd leave the rest of the
> > > investigation up to the experts!
> > >
> > > I couldn't find any related queries in the archives.
> > >
> > > Can anyone help? Or provide insight as to where I should
> start looking?
> > >
> > > Cheers,
> > > Mike
> > >
> > > Mike Cannon-Brookes :: mike(at)atlassian(dot)com
> > >
> > > Atlassian :: http://www.atlassian.com
> > > Supporting YOUR J2EE World
> > >
> > >
> > >
> > > ---------------------------(end of
> broadcast)---------------------------
> > > TIP 4: Don't 'kill -9' the postmaster
> > >
> > >
> >
> >
> >
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Tom Lane 2001-11-19 05:44:42 Re: Retrieving bytea column problem - they're are sometimes truncated
Previous Message Mike Cannon-Brookes 2001-11-17 22:44:15 Re: Retrieving bytea column problem - they're are sometimes truncated